def int_to_base36(i):
 digits = u'0123456789abcdefghijklmnopqrstuvwxyz'
 factor = 0
 if (i < 0):
  raise ValueError(u'Negative base36 conversion input.')
 if (not six.PY3):
  if (not isinstance(i, six.integer_types)):
   raise TypeError(u'Non-integer base36 conversion input.')
  if (i > sys.maxint):
   raise ValueError(u'Base36 conversion input too large.')
 while True:
  factor += 1
  if (i < (36 ** factor)):
   factor -= 1
   break
 base36 = []
 while (factor >= 0):
  j = (36 ** factor)
  base36.append(digits[(i // j)])
  i = (i % j)
  factor -= 1
 return u''.join(base36)

def int_to_base36 ( i ) : digits = u'0123456789abcdefghijklmnopqrstuvwxyz' factor = 0 if ( i < 0 ) : raise ValueError ( u'Negative base36 conversion input.' ) if ( not six . PY3 ) : if ( not isinstance ( i , six . integer_types ) ) : raise TypeError ( u'Non-integer base36 conversion input.' ) if ( i > sys . maxint ) : raise ValueError ( u'Base36 conversion input too large.' ) while True : factor += 1 if ( i < ( 36 ** factor ) ) : factor -= 1 break base36 = [ ] while ( factor >= 0 ) : j = ( 36 ** factor ) base36 . append ( digits [ ( i // j ) ] ) i = ( i % j ) factor -= 1 return u'' . join ( base36 )
converts an integer to a base36 string .