def _max_jaccard_underneath_internal_node(node, mh):
    """    calculate the maximum possibility similarity score below
    this node, based on the number of matches in 'hashes' at this node,
    divided by the smallest minhash size below this node.

    This should yield be an upper bound on the Jaccard similarity
    for any signature below this point.
    """
    if len(mh) == 0:
        return 0.0
    matches = node.data.matches(mh)
    min_n_below = node.metadata.get('min_n_below', -1)
    if min_n_below == -1:
        raise Exception(
            'cannot do similarity search on this SBT; need to rebuild.')
    max_score = float(matches) / min_n_below
    return max_score
