code: def get_data_source_instance(data_source, sagemaker_session):
      """Return an Instance of :class:`sagemaker.local.data.DataSource`.
  
      The instance can handle the provided data_source URI.
  
      data_source can be either file:// or s3://
  
      Args:
          data_source (str): a valid URI that points to a data source.
          sagemaker_session (:class:`sagemaker.session.Session`): a SageMaker Session to
              interact with S3 if required.
  
      Returns:
          sagemaker.local.data.DataSource: an Instance of a Data Source
  
      Raises:
          ValueError: If parsed_uri scheme is neither `file` nor `s3` , raise an
              error.
      """
      parsed_uri = urlparse(data_source)
      if parsed_uri.scheme == "file":
          return LocalFileDataSource(
              parsed_uri.netloc + parsed_uri.path
          )
      if parsed_uri.scheme == "s3":
          return S3DataSource(
              parsed_uri.netloc, parsed_uri.path, sagemaker_session
          )
      raise ValueError(
          "data_source must be either file or s3. parsed_uri.scheme: {}".format(
              parsed_uri.scheme
          )
      )
  
imports: from __future__ import absolute_import
  import os
  import platform
  import sys
  import tempfile
  from abc import ABCMeta
  from abc import abstractmethod
  from six import with_metaclass
  from six.moves.urllib.parse import urlparse
  import sagemaker.amazon.common
  import sagemaker.local.utils
  import sagemaker.utils
label_desc: Use image node_id 1 for calling a global function with example usage: get_data_source_instance(data_source, sagemaker_session) and returns: LocalFileDataSource, S3DataSource