> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.conductorquantum.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.conductorquantum.com/_mcp/server.

# stanza.routines.builtins.utils

Utility functions for built-in routines.

## Module Contents

### Functions

| Name | Description |
|------|-------------|
| [`filter_gates_by_group`](#stanzaroutinesbuiltinsutilsfilter_gates_by_group) | Filter a list of gates to only include those in the current group. |

### API

```python
stanza.routines.builtins.utils.filter_gates_by_group(
    ctx: stanza.routines.core.RoutineContext, gate_list: list[str]
) -> list[str]
```

Filter a list of gates to only include those in the current group.

If group is available in ctx.resources, filters gates to only
include those present in the group. Otherwise, returns the original list.

**Parameters:**

<ParamField path="ctx" type="stanza.routines.core.RoutineContext">
  Routine context containing device resources and optional group.
</ParamField>

<ParamField path="gate_list" type="list[str]">
  List of gate names to filter.
</ParamField>

**Returns:**

Filtered list of gates that are in the current group, or original list
if no group filtering is active.