code: def configure_spark(spark_session_builder, args):
      """Applies configuration to a ``SparkSession.Builder`` object.
  
      Call :func:`add_configure_spark_arguments` to add command line arguments to the argparser object.
      This function returns the ``SparkSession.Builder`` to allow chaining additional calls to the ``Builder``.
  
      >>> from pyspark.sql import SparkSession
      >>>
      >>> arg_parser = argparse.ArgumentParser()
      >>> add_configure_spark_arguments(arg_parser)
      >>> # ... more argparse arguments
  
      >>> args = arg_parser.parse_args()
      >>> spark = configure_spark(SparkSession.builder.appName('petastorm-copy'), args).getOrCreate()
  
      :param spark_session_builder: An instance of the ``pyspark.sql.session.SparkSession.Builder`` object.
      :param args: A value returned by ``argparser.ArgumentParser.parse_args()`` call.
      :return: ``SparkSession.Builder`` object.
      """
      if "spark_session_config" not in args or "master" not in args:
          raise RuntimeError(
              "--spark-session-config and/or --master were not found in parsed arguments. "
              "Call add_configure_spark_arguments() to add them."
          )
  
      spark_session_config = _cli_spark_session_config_to_dict(
          args.spark_session_config
      )
  
      for key, value in spark_session_config.items():
          spark_session_builder.config(key, value)
  
      if args.master:
          spark_session_builder.master(args.master)
  
      return spark_session_builder
  
label_desc: Use image node_id 1 for calling a global function with example usage: configure_spark(spark_session_builder, args) and returns: spark_session_builder