def to64(number):
 if (not ((type(number) is types.LongType) or (type(number) is types.IntType))):
  raise TypeError('You must pass a long or an int')
 if (0 <= number <= 9):
  return byte((number + 48))
 if (10 <= number <= 35):
  return byte((number + 55))
 if (36 <= number <= 61):
  return byte((number + 61))
 if (number == 62):
  return byte(45)
 if (number == 63):
  return byte(95)
 raise ValueError(('Invalid Base64 value: %i' % number))

def to64 ( number ) : if ( not ( ( type ( number ) is types . LongType ) or ( type ( number ) is types . IntType ) ) ) : raise TypeError ( 'You must pass a long or an int' ) if ( 0 <= number <= 9 ) : return byte ( ( number + 48 ) ) if ( 10 <= number <= 35 ) : return byte ( ( number + 55 ) ) if ( 36 <= number <= 61 ) : return byte ( ( number + 61 ) ) if ( number == 62 ) : return byte ( 45 ) if ( number == 63 ) : return byte ( 95 ) raise ValueError ( ( 'Invalid Base64 value: %i' % number ) )
converts a number in the range of 0 to 63 into base 64 digit character in the range of 0-9 .