def num_to_bytes(num):
 bval = ''
 bval += bytes(chr((255 & (num >> 24))))
 bval += bytes(chr((255 & (num >> 16))))
 bval += bytes(chr((255 & (num >> 8))))
 bval += bytes(chr((255 & (num >> 0))))
 return bval

def num_to_bytes ( num ) : bval = '' bval += bytes ( chr ( ( 255 & ( num >> 24 ) ) ) ) bval += bytes ( chr ( ( 255 & ( num >> 16 ) ) ) ) bval += bytes ( chr ( ( 255 & ( num >> 8 ) ) ) ) bval += bytes ( chr ( ( 255 & ( num >> 0 ) ) ) ) return bval
convert an integer into a four byte sequence .