def GroupEncoder(field_number, is_repeated, is_packed):
start_tag = TagBytes(field_number, wire_format.WIRETYPE_START_GROUP)<EOL>end_tag = TagBytes(field_number, wire_format.WIRETYPE_END_GROUP)<EOL>assert not is_packed<EOL>if is_repeated:<EOL><INDENT>def EncodeRepeatedField(write, value):<EOL><INDENT>for element in value:<EOL><INDENT>write(start_tag)<EOL>element._InternalSerialize(write)<EOL>write(end_tag)<EOL><DEDENT><DEDENT>return EncodeRepeatedField<EOL><DEDENT>else:<EOL><INDENT>def EncodeField(write, value):<EOL><INDENT>write(start_tag)<EOL>value._InternalSerialize(write)<EOL>return write(end_tag)<EOL><DEDENT>return EncodeField<EOL><DEDENT>
Returns an encoder for a group field.