def map_embedding_to_QUBO(QUBO, complete_embedding):
    """
    For each variable in QUBO, this function maps that variable to a set of physical qubits
    found in complete_embedding.

    Parameters
    ----------
    QUBO : dict
        keys are linear or quadratic terms, and values are the weights associated
        with each of those terms.
    complete_embedding : dict
        Large all-to-all embedding for the quantum annealing hardware.

    Returns
    -------
    out : dict
        re-mapped embedding .

    """
    vars = []
    for a in QUBO:
        vars.append(a[0])
        vars.append(a[1])
    vars = list(set(vars))
    out = {}
    c = -1
    for a in complete_embedding:
        if c == len(vars)-1:
            break
        c += 1
        out[vars[c]] = complete_embedding[a]
    return out