Utility functions for built-in routines.
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:
Routine context containing device resources and optional group.
List of gate names to filter.
Returns:
Filtered list of gates that are in the current group, or original list if no group filtering is active.