def _formatinfo(format):
 size = struct.calcsize(format)
 return (size, len(struct.unpack(format, ('\x00' * size))))

def _formatinfo ( format ) : size = struct . calcsize ( format ) return ( size , len ( struct . unpack ( format , ( '\x00' * size ) ) ) )
calculate the size and number of items in a struct format .