code: def serialize(self, include_class=True, save_dynamic=False, **kwargs):
          
          registry = kwargs.pop('registry', None)
          if registry is None:
              registry = dict()
          if not registry:
              root = True
              registry.update({'__root__': self.uid})
          else:
              root = False
          key = self.uid
          if key not in registry:
              registry.update({key: None})
              registry.update({key: super(HasUID, self).serialize(
                  registry=registry,
                  include_class=include_class,
                  save_dynamic=save_dynamic,
                  **kwargs
              )})
          if root:
              return registry
          return key
docs: Serialize nested HasUID instances to a flat dictionary
  
          **Parameters**:
  
          * **include_class** - If True (the default), the name of the class
            will also be saved to the serialized dictionary under key
            :code:`'__class__'`
          * **save_dynamic** - If True, dynamic properties are written to
            the serialized dict (default: False).
          * You may also specify a **registry** - This is the flat dictionary
            where UID/HasUID pairs are stored. By default, no registry need
            be provided; a new dictionary will be created.
          * Any other keyword arguments will be passed through to the Property
            serializers.