<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def randhex(ndigits: int) -> str: """Return a random text string of hexadecimal characters. The string has *ndigits* random digits. Raises ValueError if ndigits <= 0, and TypeError if it's not an integer. '56054d728fc56f63' """

    if not isinstance(ndigits, int):
        raise TypeError('number of digits must be an integer')
    if ndigits <= 0:
        raise ValueError('number of digits must be greater than zero')

    nbytes = ceil(ndigits / 2)
    rbytes = random_randbytes(nbytes)
    hexstr = rbytes.hex()[:ndigits]

    return hexstr