parameters: (field_descriptor)
return_statement: return EncodeField
docstring: 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;
docstring_summary: Encoder for extensions of MessageSet.
docstring_tokens: Encoder for extensions of MessageSet .
function: def MapEncoder(field_descriptor):
    """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;
    """
    # Can't look at field_descriptor.message_type._concrete_class because it may
    # not have been initialized yet.
    message_type = field_descriptor.message_type
    encode_message = MessageEncoder(field_descriptor.number, False, False)
  
    def EncodeField(write, value):
      for key in value:
        entry_msg = message_type._concrete_class(key=key, value=value[key])
        encode_message(write, entry_msg)
  
    return EncodeField
function_tokens: def MapEncoder ( field_descriptor ) : # Can't look at field_descriptor.message_type._concrete_class because it may # not have been initialized yet. message_type = field_descriptor . message_type encode_message = MessageEncoder ( field_descriptor . number , False , False ) def EncodeField ( write , value ) : for key in value : entry_msg = message_type . _concrete_class ( key = key , value = value [ key ] ) encode_message ( write , entry_msg ) return EncodeField