def save_attr(self, entity, value):
if self.datatype == self.TYPE_MANY:<EOL><INDENT>self._save_m2m_attr(entity, value)<EOL><DEDENT>else:<EOL><INDENT>self._save_single_attr(entity, value)<EOL><DEDENT>
Saves given EAV attribute with given value for given entity.

If schema is not many-to-one, the value is saved to the corresponding
Attr instance (which is created or updated).

If schema is many-to-one, the value is processed thusly:

* if value is iterable, all Attr instances for corresponding managed m2m
  schemata are updated (those with names from the value list are set to
  True, others to False). If a list item is not in available choices,
  ValueError is raised;
* if the value is None, all corresponding Attr instances are reset to False;
* if the value is neither a list nor None, it is wrapped into a list and
  processed as above (i.e. "foo" --> ["foo"]).