code: def MessageSetItemEncoder(field_number):
      """Encoder for extensions of MessageSet.
  
      The message set message looks like this:
        message MessageSet {
          repeated group Item = 1 {
            required int32 type_id = 2;
            required string message = 3;
          }
        }
      """
      start_bytes = b"".join(
          [
              TagBytes(1, wire_format.WIRETYPE_START_GROUP),
              TagBytes(2, wire_format.WIRETYPE_VARINT),
              _VarintBytes(field_number),
              TagBytes(3, wire_format.WIRETYPE_LENGTH_DELIMITED),
          ]
      )
      end_bytes = TagBytes(1, wire_format.WIRETYPE_END_GROUP)
      local_EncodeVarint = _EncodeVarint
  
      def EncodeField(write, value):
          write(start_bytes)
          local_EncodeVarint(write, value.ByteSize())
          value._InternalSerialize(write)
          return write(end_bytes)
  
      return EncodeField
  
imports: import struct
  import six
  from google.protobuf.internal import wire_format
label_desc: Use image node_id 26 for calling a global function with example usage: MessageSetItemEncoder(field_number) and returns: EncodeField, write