def base36encode(number, alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
    """Converts an integer to a base36 string."""
if not isinstance(number, int):
    raise TypeError('number must be an integer')
base36 = ''
sign = ''
if number < 0:
    sign = '-'
number = -number
if 0 <= number < len(alphabet):
    return sign + alphabet[number]
while number != 0:
    number, i = divmod(number, len(alphabet))
base36 = alphabet[i] + base36
return sign + base36

def base36decode(number):
    return int(number, 36)
print(base36encode(1412823931503067241))
print(base36decode('AQF8AA0006EH'))
Python base 36 encoding