code: def _set_fields(self, fields):
          
          for f in fields:
              if hasattr(self, f):
                  setattr(self, f, fields[f])
              else:
                  raise TypeError("'{arg}' is an invalid argument for {instance_type}".format(arg=f, instance_type=self.__class__.__name__))
docs: Helper method for :meth:`upsert` in the various subclasses