def METHOD_NAME(
    full_task_graph, filtered_for_candidates, shipping_phase
):
    def filter(task):
        # Include promotion tasks; these will be optimized out
        if task.label in filtered_for_candidates:
            return True
        if task.attributes.get("shipping_phase") == shipping_phase:
            return True
    return [
        label for label, task in full_task_graph.tasks.items()
        if filter(task)
    ]