def tree_similarity_ratio(ted, t1, t2):
    """
    Return the similarity ratio from 0 to 1 between two trees given their edit distance
    
    `ratio` idea from [DiffLib](https://fossies.org/dox/Python-3.5.1/difflib_8py_source.html)
    """
    # print(ted)
    # import networkx as nx
    # empty_tree = nx.DiGraph()
    # print('#nodes',
    #       t1.number_of_nodes(),
    #       t2.number_of_nodes())
    # print('ted against empty_tree',
    #       salzburg_ted(t1, empty_tree),
    #       salzburg_ted(t2, empty_tree))

    return 1 - 2 * ted/(t1.number_of_nodes() + t2.number_of_nodes())