import copy


def remove_index_from_both_if_equals_zero(a, b):
    """
    Scans over two lists. If any elements equal False/None, then remove that
    index from both lists.

    Arguments
    ---------
    a : list (of integers usually)
    b : list (of integers usually)

    Returns
    -------
    a : list
    b : list
    """
    assert len(a) == len(b), "Lists must be of same length!"
    # This prevents the code from breaking if the user supplies a and b as the
    # same object. It would probably be even better to check if they're the
    # exact same object than create new objects.
    a = copy.deepcopy(a)
    b = copy.deepcopy(b)
    for i in range(len(a) - 1, -1, -1):
        if not a[i] or not b[i]:
            a.pop(i)
            b.pop(i)
    return a, b