def__getattr__(self,item):try:returnself.tags[item]exceptKeyError:returnsuper().__getattribute__(item)def__new__(cls,*args,**kwargs):# pylint:disable=unused-argument"""Create a new instance and set `_tags` attribute. Since TaggedObject override `__getattr__` method and try to access the `_tags` attribute, infinite recursion could occur if `_tags` not ready to exists. This behavior causes an infinite recursion error when copying `TaggedObject` with `copy.deepcopy`. Hence, we set `_tags` attribute here to prevent this problem. """self=super().__new__(cls)self._tags=Nonereturnselfdef__hash__(self):ifself._hashisNone:self._hash=self._hash_core()returnself._hashdef_hash_core(self):raiseNotImplementedError()@propertydeftags(self)->dict:ifnotself._tags:self._tags={}returnself._tags