<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_children_to_delete(self):
 """Return all children that are not referenced :returns: list or :class:`Reftrack` :rtype: list :raises: None """

        refobjinter = self.get_refobjinter()
        children = self.get_all_children()

        todelete = []
        for c in children:
            if c.status() is None:
                # if child is not in scene we do not have to delete it
                continue
            rby = refobjinter.referenced_by(c.get_refobj())
            if rby is None:
                # child is not part of another reference.
                # we have to delete it for sure
                todelete.append(c)
                continue
            # check if child is referenced by any parent up to self
            # if it is not referenced by any refrence of a parent, then we
            # can assume it is referenced by a parent of a greater scope,
            # e.g. the parent of self. because we do not delete anything above self
            # we would have to delete the child manually
            parent = c.get_parent()
            while parent != self.get_parent():
                if refobjinter.get_reference(parent.get_refobj()) == rby:
                    # is referenced by a parent so it will get delted when the parent is deleted.
                    break
                parent = parent.get_parent()
            else:
                todelete.append(c)
        return todelete