(eq)
return inv
Assign a 5-item fingerprint to each symbol in the equation:
    [
    # of times it appeared as a Symbol,
    # of times it appeared as a Not(symbol),
    # of times it appeared as a Symbol in an And or Or,
    # of times it appeared as a Not(Symbol) in an And or Or,
    sum of the number of arguments with which it appeared,
    counting Symbol as 1 and Not(Symbol) as 2
    ]

    >>> from sympy.logic.boolalg import _finger as finger
    >>> from sympy import And, Or, Not
    >>> from sympy.abc import a, b, x, y
    >>> eq = Or(And(Not(y), a), And(Not(y), b), And(x, y))
    >>> dict(finger(eq))
    {(0, 0, 1, 0, 2): [x], (0, 0, 1, 0, 3): [a, b], (0, 0, 1, 2, 8): [y]}

    So y and x have unique fingerprints, but a and b do not.
Assign a 5-item fingerprint to each symbol in the equation:
    [
    # of times it appeared as a Symbol,
    # of times it appeared as a Not(symbol),
    # of times it appeared as a Symbol in an And or Or,
    # of times it appeared as a Not(Symbol) in an And or Or,
    sum of the number of arguments with which it appeared,
    counting Symbol as 1 and Not(Symbol) as 2
    ]
Assign a 5 - item fingerprint to each symbol in the equation : [ # of times it appeared as a Symbol # of times it appeared as a Not ( symbol ) # of times it appeared as a Symbol in an And or Or # of times it appeared as a Not ( Symbol ) in an And or Or sum of the number of arguments with which it appeared counting Symbol as 1 and Not ( Symbol ) as 2 ]
def _finger(eq):
    """
    Assign a 5-item fingerprint to each symbol in the equation:
    [
    # of times it appeared as a Symbol,
    # of times it appeared as a Not(symbol),
    # of times it appeared as a Symbol in an And or Or,
    # of times it appeared as a Not(Symbol) in an And or Or,
    sum of the number of arguments with which it appeared,
    counting Symbol as 1 and Not(Symbol) as 2
    ]

    >>> from sympy.logic.boolalg import _finger as finger
    >>> from sympy import And, Or, Not
    >>> from sympy.abc import a, b, x, y
    >>> eq = Or(And(Not(y), a), And(Not(y), b), And(x, y))
    >>> dict(finger(eq))
    {(0, 0, 1, 0, 2): [x], (0, 0, 1, 0, 3): [a, b], (0, 0, 1, 2, 8): [y]}

    So y and x have unique fingerprints, but a and b do not.
    """
    f = eq.free_symbols
    d = dict(list(zip(f, [[0] * 5 for fi in f])))
    for a in eq.args:
        if a.is_Symbol:
            d[a][0] += 1
        elif a.is_Not:
            d[a.args[0]][1] += 1
        else:
            o = len(a.args) + sum(ai.func is Not for ai in a.args)
            for ai in a.args:
                if ai.is_Symbol:
                    d[ai][2] += 1
                    d[ai][-1] += o
                else:
                    d[ai.args[0]][3] += 1
                    d[ai.args[0]][-1] += o
    inv = defaultdict(list)
    for k, v in ordered(iter(d.items())):
        inv[tuple(v)].append(k)
    return inv
def _finger ( eq ) : f = eq . free_symbols d = dict ( list ( zip ( f , [ [ 0 ] * 5 for fi in f ] ) ) ) for a in eq . args : if a . is_Symbol : d [ a ] [ 0 ] += 1 elif a . is_Not : d [ a . args [ 0 ] ] [ 1 ] += 1 else : o = len ( a . args ) + sum ( ai . func is Not for ai in a . args ) for ai in a . args : if ai . is_Symbol : d [ ai ] [ 2 ] += 1 d [ ai ] [ - 1 ] += o else : d [ ai . args [ 0 ] ] [ 3 ] += 1 d [ ai . args [ 0 ] ] [ - 1 ] += o inv = defaultdict ( list ) for k , v in ordered ( iter ( d . items ( ) ) ) : inv [ tuple ( v ) ] . append ( k ) return inv