class_docstr: Defines a data source given by a bucket and S3 prefix.
  
  The contents will be downloaded and then processed as local data.
class_docstr_tok: ["Defines","a","data","source","given","by","a","bucket","and","S3","prefix",".","The","contents","will","be","downloaded","and","then","processed","as","local","data","."]
docstr: Create an S3DataSource instance.
  
  Args:
      bucket (str): S3 bucket name
      prefix (str): S3 prefix path to the data
      sagemaker_session (:class:`sagemaker.session.Session`): a sagemaker_session with the
      desired settings
          to talk to S3
code: def __init__(self, bucket, prefix, sagemaker_session):
      """Create an S3DataSource instance.
  
      Args:
          bucket (str): S3 bucket name
          prefix (str): S3 prefix path to the data
          sagemaker_session (:class:`sagemaker.session.Session`): a sagemaker_session with the
          desired settings
              to talk to S3
      """
      super(S3DataSource, self).__init__()
  
      # Create a temporary dir to store the S3 contents
      root_dir = sagemaker.utils.get_config_value(
          "local.container_root", sagemaker_session.config
      )
      if root_dir:
          root_dir = os.path.abspath(root_dir)
  
      working_dir = tempfile.mkdtemp(dir=root_dir)
      # Docker cannot mount Mac OS /var folder properly see
      # https://forums.docker.com/t/var-folders-isnt-mounted-properly/9600
      # Only apply this workaround if the user didn't provide an alternate storage root dir.
      if root_dir is None and platform.system() == "Darwin":
          working_dir = "/private{}".format(working_dir)
  
      sagemaker.utils.download_folder(
          bucket, prefix, working_dir, sagemaker_session
      )
      self.files = LocalFileDataSource(working_dir)
  
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 to create a new S3DataSource object from inherited base classes: DataSource with example: obj = S3DataSource(bucket, prefix, sagemaker_session)