import networkx as nx


def find_bindings(and_measures):
    """
    Find the bindings given the AND measures

    Parameters
    -------------
    and_measures
        AND measures

    Returns
    -------------
    bindings
        Bindings
    """

    G = nx.Graph()
    allocated_nodes = set()
    for n1 in list(and_measures.keys()):
        if n1 not in allocated_nodes:
            allocated_nodes.add(n1)
            G.add_node(n1)
        for n2 in list(and_measures[n1].keys()):
            if n2 not in allocated_nodes:
                allocated_nodes.add(n2)
                G.add_node(n1)
            G.add_edge(n1, n2)
    ret = list(nx.find_cliques(G))
    return ret