Make a message type for the AdbTransport subclasses.

def _make_message_type(name, attributes, has_data=True):
  """Make a message type for the AdbTransport subclasses."""

  def assert_command_is(self, command):  # pylint: disable=invalid-name
    """Assert that a message's command matches the given command."""
    if self.command != command:
      raise usb_exceptions.AdbProtocolError(
          'Expected %s command, received %s', command, self)

  return type(name, (collections.namedtuple(name, attributes),),
              {
                  'assert_command_is': assert_command_is,
                  'has_data': has_data,
                  # Struct format on the wire has an unsigned int for each attr.
                  'struct_format': '<%sI' % len(attributes.split()),
              })