def int_to_cust(i):
    result = ''
while i:
    result = chrs[i % l] + result
i = i // l
if not result:
    result = chrs[0]
return result

def cust_to_int(s):
    result = 0
for char in s:
    result = result * l + chrs.find(char)
return result
Encoding a numeric string into a shortened alphanumeric string, and back again