def update(self, other=None, **kwargs):
def _set(key, value):<EOL><INDENT>if key in _ATTR2FIELD and value:<EOL><INDENT>self.set(self._convert_name(key), value)<EOL><DEDENT><DEDENT>if not other:<EOL><INDENT>pass<EOL><DEDENT>elif hasattr(other, '<STR_LIT>'):<EOL><INDENT>for k in other.keys():<EOL><INDENT>_set(k, other[k])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for k, v in other:<EOL><INDENT>_set(k, v)<EOL><DEDENT><DEDENT>if kwargs:<EOL><INDENT>for k, v in kwargs.items():<EOL><INDENT>_set(k, v)<EOL><DEDENT><DEDENT>
Set metadata values from the given iterable `other` and kwargs.

        Behavior is like `dict.update`: If `other` has a ``keys`` method,
        they are looped over and ``self[key]`` is assigned ``other[key]``.
        Else, ``other`` is an iterable of ``(key, value)`` iterables.

        Keys that don't match a metadata field or that have an empty value are
        dropped.