<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _set_parent(self, parent=None):
 """ Set parent. :param parent: Parentable object. :raises ValueError: Self-reference object passed. :raises ValueError: Non-Parentable object passed. """

        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