parameters: (message_descriptor, cls)
docstring: Helper for _AddMessageMethods().
docstring_summary: Helper for _AddMessageMethods().
docstring_tokens: Helper for _AddMessageMethods () .
function: def _AddListFieldsMethod(message_descriptor, cls):
    """Helper for _AddMessageMethods()."""
  
    def ListFields(self):
      all_fields = [item for item in self._fields.iteritems() if _IsPresent(item)]
      all_fields.sort(key = lambda item: item[0].number)
      return all_fields
  
    cls.ListFields = ListFields
function_tokens: def _AddListFieldsMethod ( message_descriptor , cls ) : def ListFields ( self ) : all_fields = [ item for item in self . _fields . iteritems ( ) if _IsPresent ( item ) ] all_fields . sort ( key = lambda item : item [ 0 ] . number ) return all_fields cls . ListFields = ListFields