def intersect(index, keys):
    """ Utility method to compute the intersection of all the sets in index
    that correspond to the given keys keys.
    Args:
        index, hash for format {key -> set()}
        keys, list of strings
    Returns:
        set, the intersection of all the sets in index that correspond to keys.
            If there is at least on key that does not exist in index, this
            method will return an empty set.
    """
    if len(keys) == 0:
        return set([])
    if keys[0] not in index:
        return set([])
    output = index[keys[0]]
    for i in range(1, len(keys)):
        key = keys[i]
        if key not in index:
            return set([])
        output = output.intersection(index[key])
    return output