code: def with_some_columns_renamed(
      fun: Callable[[str], str],
      change_col_name: Callable[[str], str],
  ) -> Callable[[DataFrame], DataFrame]:
      """Function that takes a `Callable[[str], str]` and a `Callable[[str], str]` and returns a `Callable[[DataFrame], DataFrame]`.
  
      Which in turn takes a `DataFrame` and returns a `DataFrame` with some of its columns renamed.
  
      :param fun: A function that takes a column name as a string and returns a
      new name as a string.
      :type fun: `Callable[[str], str]`
      :param change_col_name: A function that takes a column name as a string and
      returns a boolean.
      :type change_col_name: `Callable[[str], str]`
      :return: A `Callable[[DataFrame], DataFrame]`, which takes a
      `DataFrame` and returns a `DataFrame` with some of its columns renamed.
      :rtype: `Callable[[DataFrame], DataFrame]`
      """
  
      def _(df: DataFrame) -> DataFrame:
          cols = [
              F.col(f"`{col_name}`").alias(fun(col_name))
              if change_col_name(col_name)
              else F.col(f"`{col_name}`")
              for col_name in df.columns
          ]
          return df.select(*cols)
  
      return _
  
file_path: quinn/quinn/transformations.py
imports: from __future__ import annotations
  import re
  from collections.abc import Callable
  from pyspark.sql import DataFrame, SparkSession
  from pyspark.sql import functions
  from pyspark.sql.types import ArrayType, MapType, StructField, StructType
  from quinn.schema_helpers import complex_fields
label_desc: Use image node_id 2 for calling a global function with example usage: with_some_columns_renamed(fun, change_col_name) and returns: _, df