<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def next_sibling(self):
 """ Returns the next sibling of the current node. The next sibling is searched in the parent node if we are not considering a top-level node. Otherwise it is searched inside the list of nodes (which should be sorted by tree ID) that is associated with the considered tree instance. """

        if self.parent:
            nodes = self.parent.children
            index = nodes.index(self)
            sibling = nodes[index + 1] if index < len(nodes) - 1 else None
        else:
            nodes = self.tree.nodes
            index = nodes.index(self)
            sibling = (
                next((n for n in nodes[index + 1:] if n.level == self.level), None)
                if index < len(nodes) - 1 else None
            )
        return sibling