code: def show_output_to_df(
      show_output: str, spark: SparkSession
  ) -> DataFrame:
      """Show output as spark DataFrame.
  
      :param show_output: String representing output of 'show' command in spark
      :type show_output: str
      :param spark: SparkSession object
      :type spark: SparkSession
      :return: DataFrame object containing output of a show command in spark
      :rtype: Dataframe
      """
      lines = show_output.split("\n")
      ugly_column_names = lines[1]
      pretty_column_names = [
          i.strip() for i in ugly_column_names[1:-1].split("|")
      ]
      pretty_data = []
      ugly_data = lines[3:-1]
      for row in ugly_data:
          r = [i.strip() for i in row[1:-1].split("|")]
          pretty_data.append(tuple(r))
      return spark.createDataFrame(pretty_data, pretty_column_names)
  
file_path: quinn/quinn/dataframe_helpers.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING
  from typing import Any
  from pyspark.sql.types import StructField, StructType
label_desc: Use image node_id 5 for calling a global function with example usage: show_output_to_df(show_output, spark) and returns: spark