code: def new_headers(
      header_block: str,
      alpha_names: Iterable[str],
      row_indexer: List[Tuple[str, str]],
  ) -> Tuple[str, List[int], List[str]]:
      """
      Creates new headers for the output of a matrix reduction step.  Generally produces names like
      "block_[header_block_number]_alpha_[alpha_name]_label_[label_name]"
  
      Args:
          header_block : Identifier for a header_block (e.g., 'chr_1_block_0')
          alpha_names : List of string identifiers for alpha parameters
          row_indexer : A list of tuples provided by the cross_alphas_and_labels function
  
      Returns:
          new_header_block : A new header_block name, typically the chromosome (e.g. chr_1), but might be 'all' if
          there are no more levels to reduce over.
          sort_keys : Array of sortable integers to specify the ordering of the new matrix headers.
          headers : List of new matrix headers.
      """
      match_chr_block = re.search(
          r"^chr_(.*)_block_([0-9]+)$", header_block
      )
      match_chr = re.search(r"^chr_(.*)$", header_block)
      if match_chr_block:
          chr = match_chr_block.group(1)
          inner_index = int(match_chr_block.group(2))
          header_prefix = f"chr_{chr}_block_{inner_index}_"
          new_header_block = f"chr_{chr}"
      elif match_chr:
          chr = match_chr.group(1)
          inner_index = abs(hash(chr)) % (10**8)  # Hash to 8 digits
          header_prefix = f"chr_{chr}_"
          new_header_block = "all"
      elif header_block == "all":
          inner_index = 0
          header_prefix = ""
          new_header_block = "all"
      else:
          raise ValueError(
              f"Header block {header_block} does not match expected pattern."
          )
  
      sort_keys, headers = [], []
      for a, l in row_indexer:
          sort_key = inner_index * len(alpha_names) + int(
              re.search(r"^alpha_([0-9]+)", a).group(1)
          )
          sort_keys.append(sort_key)
          header = f"{header_prefix}{a}_label_{l}"
          headers.append(header)
  
      return new_header_block, sort_keys, headers
  
imports: import itertools
  import math
  import re
  import warnings
  from typing import Any, Dict, Iterable, List, Tuple
  import numpy
  import pandas
  import pyspark.sql.functions
  import scipy.optimize
  from nptyping import Float, Int, NDArray
  from pyspark.sql import DataFrame, Row
  from pyspark.sql.window import Window
  from typeguard import typechecked
label_desc: Use image node_id 11 for calling a global function with example usage: new_headers(header_block, alpha_names, row_indexer) and returns: new_header_block,  sort_keys,  headers