def extract_processes_and_labels_for_steps(
    steps: Iterable[Step],
    step_tag: str,
    add_step_prefix: bool = False,
    neutral_is_good: bool = True,
) -> Iterable[tuple[list[str], list[str]]]:
    """
    For each reason step, return all its contents and labels as a tuple of two
    lists.

    Args:
      steps: A list of `Step` instances.
      neutral_is_good: Cast `neutral` label to `good` if True, otherwise `bad`.

    Returns:
      Tuples of two lists, one contains all completions of this step and the other
      contains corresponding labels. Each tuple corresponds to a step.
    """
    steps_with_ind = enumerate(steps)  # [(ind, Step)] = [(ind, [(text, rating)])]

    def deal_with_one_step(ind: int, step: Step) -> tuple[list[str], list[str]]:
        assert step.completions is not None
        lst_of_proc_lbl_tuple = map(
            lambda completion: get_process_and_label(
                ind, completion, step_tag, add_step_prefix, neutral_is_good
            ),
            step.completions,
        )  # [(str, str)]
        tuple_of_proc_lbl_lst: tuple[list[str], list[str]] = ft.reduce(
            lambda res, tup: (res[0] + [tup[0]], res[1] + [tup[1]]),  # type: ignore
            lst_of_proc_lbl_tuple,
            ([], []),
        )  # ([str], [str])
        return tuple_of_proc_lbl_lst

    steps_of_proc_and_lbl = map(
        lambda x: deal_with_one_step(*x), steps_with_ind
    )  # [([str], [str])]
    return steps_of_proc_and_lbl

    For each reason step, return all its contents and labels as a tuple of two
    lists.

    Args:
      steps: A list of `Step` instances.
      neutral_is_good: Cast `neutral` label to `good` if True, otherwise `bad`.

    Returns:
      Tuples of two lists, one contains all completions of this step and the other
      contains corresponding labels. Each tuple corresponds to a step.
    
preprocess/src/preprocessors/prm800k.py