<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def randbelow(num: int) -> int: """Return a random int in the range [0,num). Raises ValueError if num <= 0, and TypeError if it's not an integer. 13 """

    if not isinstance(num, int):
        raise TypeError('number must be an integer')
    if num <= 0:
        raise ValueError('number must be greater than zero')
    if num == 1:
        return 0

    # https://github.com/python/cpython/blob/3.6/Lib/random.py#L223
    nbits = num.bit_length()    # don't use (n-1) here because n can be 1
    randnum = random_randint(nbits)    # 0 <= randnum < 2**nbits
    while randnum >= num:
        randnum = random_randint(nbits)
    return randnum