def int2bytes(number):
 if (not ((type(number) is types.LongType) or (type(number) is types.IntType))):
  raise TypeError('You must pass a long or an int')
 string = ''
 while (number > 0):
  string = ('%s%s' % (byte((number & 255)), string))
  number /= 256
 return string

def int2bytes ( number ) : if ( not ( ( type ( number ) is types . LongType ) or ( type ( number ) is types . IntType ) ) ) : raise TypeError ( 'You must pass a long or an int' ) string = '' while ( number > 0 ) : string = ( '%s%s' % ( byte ( ( number & 255 ) ) , string ) ) number /= 256 return string
converts a number to a string of bytes .