





def 		lowerCAmelCase_    (  __UpperCAmelCase:			bytes      )      ->	str:
    return "".join([hex(__UpperCAmelCase      )[2:].zfill(2      ).upper() for byte in list(__UpperCAmelCase      )]      )




def 		lowerCAmelCase_    (  __UpperCAmelCase:			str      )      ->	bytes:
    # Check data validity, following RFC3548
    # https://www.ietf.org/rfc/rfc3548.txt
    if (len(__UpperCAmelCase      ) % 2) != 0:
        raise ValueError(
            '''Base16 encoded data is invalid:
Data does not have an even number of hex digits.'''      )
    # Check the character set - the standard base16 alphabet
    # is uppercase according to RFC3548 section 6
    if not set(__UpperCAmelCase      ) <= set('''0123456789ABCDEF'''      ):
        raise ValueError(
            '''Base16 encoded data is invalid:
Data is not uppercase hex or it contains invalid characters.'''      )
    # For every two hexadecimal digits (= a byte), turn it into an integer.
    # Then, string the result together into bytes, and return it.
    return bytes(int(data[i] + data[i + 1]		,   16      ) for i in range(0		,   len(__UpperCAmelCase      )		,   2      )      )


if __name__ == "__main__":
  import doctest

  doctest.testmod()








UpperCAmelCase_     							= 'Input must be a string of 8 numbers plus letter'
UpperCAmelCase_     							= 'TRWAGMYFPDXBNJZSQVHLCKE'




def 		lowerCAmelCase_    (  __UpperCAmelCase:			str      )      ->	bool:

    if not isinstance(__UpperCAmelCase		,   __UpperCAmelCase      ):
        UpperCamelCase__							:				Any          =      f"Expected string as input, found {type(__UpperCAmelCase      ).__name__}"
        raise TypeError(__UpperCAmelCase      )

    UpperCamelCase__							:				int          =      spanish_id.replace('''-'''		,   ''''''      ).upper()
    if len(__UpperCAmelCase      ) != 9:
        raise ValueError(__UpperCAmelCase      )

    try:
        UpperCamelCase__							:				List[str]          =      int(spanish_id_clean[0:8]      )
        UpperCamelCase__							:				Optional[int]          =      spanish_id_clean[8]
    except ValueError as ex:
        raise ValueError(__UpperCAmelCase      ) from ex

    if letter.isdigit():
        raise ValueError(__UpperCAmelCase      )

    return letter == LOOKUP_LETTERS[number % 23]


if __name__ == "__main__":
  import doctest

  doctest.testmod()

