def _parse_routine_definition(routine_definition: str) -> str:
    """
    Normalize the indentation of a function body to a standard 4-space indent.

    This function processes a raw routine definition string by:
      1. Dedenting the entire block (using textwrap.dedent) to remove any common
         leading whitespace.
      2. Splitting the dedented text into lines.
      3. Determining the "standard" indent (i.e. the minimum nonzero indent among lines).
      4. Calculating an indent factor as int(4 / indent_standard) to scale the original
         indentation to a 4-space baseline.
      5. For each nonempty line, computing the new indent level as:
             new_indent = (original indent) * indent_factor
         and reformatting the line with that indent (using line.strip() to remove trailing
         whitespace).
      6. Finally, reindenting the entire block by an additional 4 spaces (for overall nesting).

    NB:
      - The methodology assumes that the smallest nonzero indent found in the block
        represents the "unit" of indentation in the original text.
      - If such an indent is found, the indent_factor scales all indentations so that the
        unit becomes 4 spaces. For example, if the original unit is 2 spaces, the factor will
        be 2 (i.e. 4 / 2), converting a 2-space indent to 4 spaces and a 6-space indent to 12 spaces.
      - If no nonzero indent is found (i.e. baseline is 0), the indent_factor defaults to 1,
        and every nonempty line is given a fixed indent of 4 spaces.
      - This approach preserves the relative indentation of nested blocks while standardizing
        the overall appearance of the function body.

    Args:
        routine_definition (str): The raw routine definition string with its original indentation.

    Returns:
        str: The normalized function body, where each nonempty line is reindented based on a 4-space standard.
    """
    dedented = dedent(routine_definition).rstrip()
    lines = dedented.splitlines()

    indent_standard = min(
        [len(line) - len(line.lstrip()) for line in lines if len(line.lstrip()) < len(line)],
        default=0,
    )
    indent_factor = 4 // indent_standard if indent_standard > 0 else 1
    normalized_lines = []
    for line in lines:
        if line.strip():
            indent_level = (len(line) - len(line.lstrip())) * indent_factor
            normalized_lines.append(" " * indent_level + line.strip())
        else:
            normalized_lines.append("")
    return indent("\n".join(normalized_lines), PRIMARY_INDENT)

    Normalize the indentation of a function body to a standard 4-space indent.

    This function processes a raw routine definition string by:
      1. Dedenting the entire block (using textwrap.dedent) to remove any common
         leading whitespace.
      2. Splitting the dedented text into lines.
      3. Determining the "standard" indent (i.e. the minimum nonzero indent among lines).
      4. Calculating an indent factor as int(4 / indent_standard) to scale the original
         indentation to a 4-space baseline.
      5. For each nonempty line, computing the new indent level as:
             new_indent = (original indent) * indent_factor
         and reformatting the line with that indent (using line.strip() to remove trailing
         whitespace).
      6. Finally, reindenting the entire block by an additional 4 spaces (for overall nesting).

    NB:
      - The methodology assumes that the smallest nonzero indent found in the block
        represents the "unit" of indentation in the original text.
      - If such an indent is found, the indent_factor scales all indentations so that the
        unit becomes 4 spaces. For example, if the original unit is 2 spaces, the factor will
        be 2 (i.e. 4 / 2), converting a 2-space indent to 4 spaces and a 6-space indent to 12 spaces.
      - If no nonzero indent is found (i.e. baseline is 0), the indent_factor defaults to 1,
        and every nonempty line is given a fixed indent of 4 spaces.
      - This approach preserves the relative indentation of nested blocks while standardizing
        the overall appearance of the function body.

    Args:
        routine_definition (str): The raw routine definition string with its original indentation.

    Returns:
        str: The normalized function body, where each nonempty line is reindented based on a 4-space standard.
    
ai/core/src/unitycatalog/ai/core/utils/callable_utils.py