def handling(
      cls,
      body: layer_base.LayerLike,
      tags: Sequence[Tag],
      handler_id: str | None = None,
  ) -> WithSideInputsFromInputTuple:
    """Builds a `WithSideInputsFromInputTuple` handling effects in this layer.

    Args:
      body: The layer to wrap. Usually will contain `SideInputRequest` nodes. If
        any `SideInputRequest` has an explicit structure, all such structures
        must agree and will be used for shapechecking.
      tags: The tags of each of the side inputs we are providing.
      handler_id: ID to use for the handler. If None, will be inferred.

    Returns:
      A ``WithSideInputsFromInputTuple`` handler wrapping `body`, with its side
      input requests with the given tags replaced with references to this
      handler.
    """
    if isinstance(tags, str):
      raise ValueError(
          "WithSideInputsFromInputTuple expects a sequence of tags as its"
          " `tags` argument, but got a string. Strings are technically"
          " sequences of characters, but this is rarely the desired behavior."
          " Please pass an explicit sequence (e.g. a list or tuple)."
      )
    handler_id = effect_base.infer_or_check_handler_id(
        "WithSideInputsFromInputTuple", body, explicit_id=handler_id
    )
    tags = tuple(tags)
    tag_set = set(tags)
    selected_holes = (
        selectors.select(body)
        .at_instances_of(SideInputRequest)
        .where(lambda hole: hole.tag in tag_set)
    )
    return cls(
        handler_id=handler_id,
        body=selected_holes.apply(
            lambda hole: HandledSideInputRef(
                handler_id=handler_id, tag=hole.tag
            )
        ),
        side_input_tags=tags,
    )
Builds a `WithSideInputsFromInputTuple` handling effects in this layer.

    Args:
      body: The layer to wrap. Usually will contain `SideInputRequest` nodes. If
        any `SideInputRequest` has an explicit structure, all such structures
        must agree and will be used for shapechecking.
      tags: The tags of each of the side inputs we are providing.
      handler_id: ID to use for the handler. If None, will be inferred.

    Returns:
      A ``WithSideInputsFromInputTuple`` handler wrapping `body`, with its side
      input requests with the given tags replaced with references to this
      handler.
    
penzai/deprecated/v1/data_effects/side_input.py