code: def mavfmt(field, typeInfo=False):
      '''work out the struct format for a type'''
      map = {
          'float'    : ('float', 'Float'),
          'double'   : ('double', 'Double'),
          'char'     : ('byte', 'Byte'),
          'int8_t'   : ('byte', 'Byte'),
          'uint8_t'  : ('short', 'UnsignedByte'),
          'uint8_t_mavlink_version'  : ('short', 'UnsignedByte'),
          'int16_t'  : ('short', 'Short'),
          'uint16_t' : ('int', 'UnsignedShort'),
          'int32_t'  : ('int', 'Int'),
          'uint32_t' : ('long', 'UnsignedInt'),
          'int64_t'  : ('long', 'Long'),
          'uint64_t' : ('long', 'UnsignedLong'),
      }
      
      if typeInfo:
          return map[field.type][1]
      else:
          return map[field.type][0f mavfmt(field, typeInfo=False):
      '''work out the struct format for a type'''
      map = {
          'float'    : ('float', 'Float'),
          'double'   : ('double', 'Double'),
          'char'     : ('byte', 'Byte'),
          'int8_t'   : ('byte', 'Byte'),
          'uint8_t'  : ('short', 'UnsignedByte'),
          'uint8_t_mavlink_version'  : ('short', 'UnsignedByte'),
          'int16_t'  : ('short', 'Short'),
          'uint16_t' : ('int', 'UnsignedShort'),
          'int32_t'  : ('int', 'Int'),
          'uint32_t' : ('long', 'UnsignedInt'),
          'int64_t'  : ('long', 'Long'),
          'uint64_t' : ('long', 'UnsignedLong'),
      }
      
      if typeInfo:
          return map[field.type][1]
      else:
          return map[field.type][0]
docs: work out the struct format for a type