def rnni(self, times=1, **kwargs):
        """ Applies a NNI operation on a randomly chosen edge.
        keyword args: use_weighted_choice (True/False) weight the random edge selection by edge length
                      transform (callable) transforms the edges using this function, prior to weighted selection
        """

        nni = NNI(self.copy())
        for _ in range(times):
            nni.rnni(**kwargs)
        # nni.reroot_tree()
        return nni.tree
Applies a NNI operation on a randomly chosen edge.
        keyword args: use_weighted_choice (True/False) weight the random edge selection by edge length
                      transform (callable) transforms the edges using this function, prior to weighted selection