def matchKeys(keyA, keyB):
    """Return the tuple (keyA, keyB) after removing bits where Bob's measured photon
    was absorbed. Assumes a value of -1 in keyB represents an absorbed photon.
    """
    match = [False if k == -1 else True for k in keyB]
    keyB = [keyB[k] for k in range(len(keyB)) if match[k]]

    while len(match) < len(keyA):
        match.append(True)
    keyA = [keyA[k] for k in range(len(keyA)) if match[k]]

    return (keyA, keyB)