def decode36(data):
    """
    Converts an integer into a base36 string.
    """
    # http://geophysics.eas.gatech.edu/GTEQ/Scream4.4/Decoding_Base_36_numbers_C.htm
    s = ''
    while data:
        imed = data % 36
        if imed > 9:
            c = chr(imed - 10 + ord('A'))
        else:
            c = chr(imed + ord('0'))
        s = c + s
        data = data // 36
    return s