<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove_links(self, parent, children):
 """Remove dependency links from parent to child. Any sensors that have no dependency links are removed from the tree and the tree detaches from each sensor removed. After all dependency links have been removed the parent is recalculated. Links that don't exist are ignored. Parameters parent : :class:`katcp.Sensor` object The sensor that used to depend on children. children : sequence of :class:`katcp.Sensor` objects The sensors that parent used to depend on. """

        old_sensors = []
        if parent in self:
            for child in children:
                if child not in self:
                    continue
                self._parent_to_children[parent].discard(child)
                self._child_to_parents[child].discard(parent)
                if not self._child_to_parents[child] and \
                        not self._parent_to_children[child]:
                    self._remove_sensor(child)
                    old_sensors.append(child)
            if not self._child_to_parents[parent] and \
                    not self._parent_to_children[parent]:
                self._remove_sensor(parent)
                old_sensors.append(parent)

        for sensor in old_sensors:
            sensor.detach(self)
        self.recalculate(parent, children)