code: def _upload_spark_submit_deps(
      submit_deps: List[str],
      workspace_name: str,
      s3_base_uri: str,
      s3_kms_key: str,
      sagemaker_session: Session,
  ) -> str:
      """Upload the Spark submit dependencies to S3.
  
      Args:
          submit_deps (List[str]): A list of path which points to the Spark dependency files.
            The path can be either a local path or S3 uri. For example ``/local/deps.jar`` or
            ``s3://<your-bucket>/deps.jar``.
  
          workspace_name (str): workspace name for Spark dependency.
          s3_base_uri (str): S3 location that the Spark dependencies will be uploaded to.
          s3_kms_key (str): kms key used to encrypt the files uploaded to S3.
          sagemaker_session (str): SageMaker boto client session.
  
      Returns:
          str : The concatenated path of all dependencies which will be passed to Spark.
      """
      spark_opt_s3_uris = []
      if not submit_deps:
          return None
  
      if not workspace_name or not s3_base_uri:
          raise ValueError(
              "workspace_name or s3_base_uri may not be empty."
          )
  
      for dep_path in submit_deps:
          dep_url = urlparse(dep_path)
  
          if dep_url.scheme in ["s3", "s3a"]:
              spark_opt_s3_uris.append(dep_path)
          elif not dep_url.scheme or dep_url.scheme == "file":
              if not os.path.isfile(dep_path):
                  raise ValueError(
                      f"submit_deps path {dep_path} is not a valid local file."
                  )
  
              upload_path = S3Uploader.upload(
                  local_path=dep_path,
                  desired_s3_uri=s3_path_join(
                      s3_base_uri, workspace_name
                  ),
                  kms_key=s3_kms_key,
                  sagemaker_session=sagemaker_session,
              )
  
              spark_opt_s3_uris.append(upload_path)
              logger.info(
                  "Uploaded the local file %s to %s",
                  dep_path,
                  upload_path,
              )
      return str.join(",", spark_opt_s3_uris)
  
imports: from __future__ import absolute_import
  import dataclasses
  import os
  import re
  import shutil
  import sys
  import json
  import secrets
  from typing import Callable, Dict, List, Optional, Tuple, Union, TYPE_CHECKING
  from urllib.parse import urlparse
  from io import BytesIO
  from sagemaker.config.config_schema import REMOTE_FUNCTION_ENVIRONMENT_VARIABLES, REMOTE_FUNCTION_IMAGE_URI, REMOTE_FUNCTION_DEPENDENCIES, REMOTE_FUNCTION_PRE_EXECUTION_COMMANDS, REMOTE_FUNCTION_PRE_EXECUTION_SCRIPT, REMOTE_FUNCTION_INCLUDE_LOCAL_WORKDIR, REMOTE_FUNCTION_INSTANCE_TYPE, REMOTE_FUNCTION_JOB_CONDA_ENV, REMOTE_FUNCTION_ROLE_ARN, REMOTE_FUNCTION_S3_ROOT_URI, REMOTE_FUNCTION_S3_KMS_KEY_ID, REMOTE_FUNCTION_VOLUME_KMS_KEY_ID, REMOTE_FUNCTION_TAGS, REMOTE_FUNCTION_VPC_CONFIG_SUBNETS, REMOTE_FUNCTION_VPC_CONFIG_SECURITY_GROUP_IDS, REMOTE_FUNCTION_ENABLE_INTER_CONTAINER_TRAFFIC_ENCRYPTION
  from sagemaker.experiments._run_context import _RunContext
  from sagemaker.experiments.run import Run
  from sagemaker.image_uris import get_base_python_image_uri
  from sagemaker import image_uris
  from sagemaker.remote_function.checkpoint_location import CheckpointLocation
  from sagemaker.session import get_execution_role, _logs_for_job, Session
  from sagemaker.utils import name_from_base, _tmpdir, resolve_value_from_config, format_tags, Tags
  from sagemaker.s3 import s3_path_join, S3Uploader
  from sagemaker import vpc_utils
  from sagemaker.remote_function.core.stored_function import StoredFunction, _SerializedData
  from sagemaker.remote_function.core.pipeline_variables import Context
  from sagemaker.remote_function.runtime_environment.runtime_environment_manager import RuntimeEnvironmentManager, _DependencySettings
  from sagemaker.remote_function import logging_config
  from sagemaker.remote_function.spark_config import SparkConfig
  from sagemaker.spark import defaults
  from sagemaker.remote_function.custom_file_filter import CustomFileFilter, copy_workdir, resolve_custom_file_filter_from_config_file
label_desc: Use image node_id 7 for calling a global function with example usage: _upload_spark_submit_deps(submit_deps, workspace_name, s3_base_uri, s3_kms_key, sagemaker_session) and returns: str, None