<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reversible_deroot(self):
 """ Stores info required to restore rootedness to derooted Tree. Returns the edge that was originally rooted, the length of e1, and the length of e2. Dendropy Derooting Process: In a rooted tree the root node is bifurcating. Derooting makes it trifurcating. Call the two edges leading out of the root node e1 and e2. Derooting with Tree.deroot() deletes one of e1 and e2 (let's say e2), and stretches the other to the sum of their lengths. Call this e3. Rooted tree: Derooted tree: A A B |_ B \ / / | /e1 |e3 (length = e1+e2; e2 is deleted) Root--o ===> | \e2 Root--o _ C \ _ C | | D D """

        root_edge = self._tree.seed_node.edge
        lengths = dict([(edge, edge.length) for edge
                        in self._tree.seed_node.incident_edges() if edge is not root_edge])
        self._tree.deroot()
        reroot_edge = (set(self._tree.seed_node.incident_edges())
                       & set(lengths.keys())).pop()
        self._tree.encode_bipartitions()
        self._dirty = True
        return (reroot_edge, reroot_edge.length - lengths[reroot_edge],
                lengths[reroot_edge])