def _wrap_element(self, element):
def dirty_callback():<EOL><INDENT>self._set_dirty()<EOL><DEDENT>if isinstance(element, list):<EOL><INDENT>element = ProxyList(element, dirty_callback=dirty_callback)<EOL><DEDENT>elif isinstance(element, dict):<EOL><INDENT>element = ProxyDict(element, dirty_callback=dirty_callback)<EOL><DEDENT>elif getattr(element, '<STR_LIT>', self._sentinel) is not self._sentinel:<EOL><INDENT>if not callable(element._dirty_callback):<EOL><INDENT>element._dirty_callback = dirty_callback<EOL><DEDENT><DEDENT>return element<EOL>
We want to know if an item is modified that is stored in this dict. If the element is a list or dict,
we wrap it in a ProxyList or ProxyDict, and if it is modified execute a callback that updates this
instance. If it is a ZenpyObject, then the callback updates the parent object.