def MapEncoder(field_descriptor):
<EOL>message_type = field_descriptor.message_type<EOL>encode_message = MessageEncoder(field_descriptor.number, False, False)<EOL>def EncodeField(write, value):<EOL><INDENT>for key in value:<EOL><INDENT>entry_msg = message_type._concrete_class(key=key, value=value[key])<EOL>encode_message(write, entry_msg)<EOL><DEDENT><DEDENT>return EncodeField<EOL>
Encoder for extensions of MessageSet.

    Maps always have a wire format like this:
      message MapEntry {
        key_type key = 1;
        value_type value = 2;
      }
      repeated MapEntry map = N;