def get_relevant_dcs(attr, sequence, dcs, exclude_fd):
    """
    Check if attr is in any dc, and that dc has all other attributes in sequence[:attr_idx]

    Return a list of dc_idx
    """
    relevant_dc_idx = []
    attr_idx = sequence.index(attr)
    for dc_idx, dc in enumerate(dcs):
        if attr in dc.components and set(dc.components).issubset(set(sequence[:attr_idx + 1])):
            if not dc.isFD or not exclude_fd:
                relevant_dc_idx.append(dc_idx)

    return relevant_dc_idx