```python
def capped_compositions(total: int, parts: int, lo: int, hi: int) -> int:
    if parts <= 0 or not isinstance(parts, int):
        raise ValueError("parts must be a positive integer")
    if lo < 0 or not isinstance(lo, int):
        raise ValueError("lo must be a non-negative integer")
    if hi < 0 or not isinstance(hi, int):
        raise ValueError("hi must be a non-negative integer")
    if lo > hi:
        raise ValueError("lo must be less than or equal to hi")
    if total != int(total) and total is not None:
        raise ValueError("total must be an integer")

    dp = [[0] * (parts + 1) for _ in range(total + 1)]
    dp[0][0] = 1

    for i in range(1, total + 1):
        for j in range(1, parts + 1):
            dp[i][j] = sum(dp[i - k][j - 1] for k in range(lo, min(hi + 1, i + 1)))

    return dp[total][parts]
```