def _createStructFormat():
 format = {BIG_ENDIAN: {}, LITTLE_ENDIAN: {}}
 for struct_format in 'BHILQ':
  try:
   size = calcsize(struct_format)
   format[BIG_ENDIAN][size] = ('>%s' % struct_format)
   format[LITTLE_ENDIAN][size] = ('<%s' % struct_format)
  except struct_error:
   pass
 return format

def _createStructFormat ( ) : format = { BIG_ENDIAN : { } , LITTLE_ENDIAN : { } } for struct_format in 'BHILQ' : try : size = calcsize ( struct_format ) format [ BIG_ENDIAN ] [ size ] = ( '>%s' % struct_format ) format [ LITTLE_ENDIAN ] [ size ] = ( '<%s' % struct_format ) except struct_error : pass return format
create a dictionnary => struct format used by str2long() to convert raw data to positive integer .