def remove_tags(
    circuit: cirq.AbstractCircuit,
    *,
    context: cirq.TransformerContext | None = None,
    target_tags: set[Hashable] | None = None,
    remove_if: Callable[[Hashable], bool] = lambda _: False,
) -> cirq.Circuit:
    """Removes tags from the operations based on the input args.

    Args:
        circuit: Input circuit to apply the transformations on. The input circuit is not mutated.
        context: `cirq.TransformerContext` storing common configurable options for transformers.
        target_tags: Tags to be removed.
        remove_if: A callable(tag) that returns True if the tag should be removed.
          Defaults to False.

    Returns:
        Copy of the transformed input circuit.
    """
    if context and context.tags_to_ignore:
        raise ValueError("remove_tags doesn't support tags_to_ignore, use function args instead.")
    target_tags = target_tags or set()

    def _map_func(op: cirq.Operation, _) -> cirq.OP_TREE:
        remaing_tags = set()
        for tag in op.tags:
            if not remove_if(tag) and tag not in target_tags:
                remaing_tags.add(tag)

        return op.untagged.with_tags(*remaing_tags)

    return transformer_primitives.map_operations(
        circuit, _map_func, deep=context.deep if context else False
    ).unfreeze(copy=False)
Removes tags from the operations based on the input args.

    Args:
        circuit: Input circuit to apply the transformations on. The input circuit is not mutated.
        context: `cirq.TransformerContext` storing common configurable options for transformers.
        target_tags: Tags to be removed.
        remove_if: A callable(tag) that returns True if the tag should be removed.
          Defaults to False.

    Returns:
        Copy of the transformed input circuit.
    
cirq-core/cirq/transformers/tag_transformers.py