<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def random_tree(n_leaves):
 """ Randomly partition the nodes """

    def _random_subtree(leaves):
        if len(leaves) == 1:
            return leaves[0]
        elif len(leaves) == 2:
            return (leaves[0], leaves[1])
        else:
            split = npr.randint(1, len(leaves)-1)
            return (_random_subtree(leaves[:split]),
                    _random_subtree(leaves[split:]))

    return _random_subtree(np.arange(n_leaves))