def METHOD_NAME(tree, max_prefix_length=128):
    """Returns the leaf node with highest prefix length.
    If several found; returns the first hit."""
    def _dfs(tree, maxval):
        for node in tree.keys():
            if _is_leaf_node(tree[node]):
                if maxval.prefixlen() < node.prefixlen() <= max_prefix_length:
                    maxval = node
            else:
                result = _dfs(tree[node], maxval)
                if maxval.prefixlen() < result.prefixlen() <= max_prefix_length:
                    maxval = result
        return maxval
    root = next(iter(tree.keys()))
    return _dfs(tree, root)