code: def iter_fields(self, exclude=None, only=None):
          
          for name in self.fields:
              if (exclude is only is None) or \
                 (exclude is not None and name not in exclude) or \
                 (only is not None and name in only):
                  try:
                      yield name, getattr(self, name)
                  except AttributeError:
                      pass
docs: This method iterates over all fields that are defined and yields
          ``(key, value)`` tuples.  Per default all fields are returned, but
          it's possible to limit that to some fields by providing the `only`
          parameter or to exclude some using the `exclude` parameter.  Both
          should be sets or tuples of field names.