code: def _set_parent(self, parent=None):
          
          if parent is not None:
              if not isinstance(parent, Parentable):
                  raise ValueError('Parent object must implement Parentable interface.')
              if parent is self or parent._contains(self):
                  raise ValueError('Self references are not allowed.')
          self._parent = parent if parent is not None else None
docs: Set parent.
  
          :param parent: Parentable object.
          :raises ValueError: Self-reference object passed.
          :raises ValueError: Non-Parentable object passed.