def _AddListFieldsMethod(message_descriptor, cls):
def ListFields(self):<EOL><INDENT>all_fields = [item for item in self._fields.items() if _IsPresent(item)]<EOL>all_fields.sort(key = lambda item: item[<NUM_LIT:0>].number)<EOL>return all_fields<EOL><DEDENT>cls.ListFields = ListFields<EOL>
Helper for _AddMessageMethods().