code: def move_to_destination(
      source, destination, job_name, sagemaker_session, prefix=""
  ):
      """Move source to destination.
  
      Can handle uploading to S3.
  
      Args:
          source (str): root directory to move
          destination (str): file:// or s3:// URI that source will be moved to.
          job_name (str): SageMaker job name.
          sagemaker_session (sagemaker.Session): a sagemaker_session to interact
              with S3 if needed
          prefix (str, optional): the directory on S3 used to save files, default
              to the root of  ``destination``
  
      Returns:
          (str): destination URI
      """
      parsed_uri = urlparse(destination)
      if parsed_uri.scheme == "file":
          dir_path = os.path.abspath(
              parsed_uri.netloc + parsed_uri.path
          )
          recursive_copy(source, dir_path)
          final_uri = destination
      elif parsed_uri.scheme == "s3":
          bucket = parsed_uri.netloc
          path = s3.s3_path_join(parsed_uri.path, job_name, prefix)
          final_uri = s3.s3_path_join("s3://", bucket, path)
          sagemaker_session.upload_data(source, bucket, path)
      else:
          raise ValueError(
              "Invalid destination URI, must be s3:// or file://, got: %s"
              % destination
          )
  
      try:
          shutil.rmtree(source)
      except OSError as exc:
          # on Linux, when docker writes to any mounted volume, it uses the container's user. In most
          # cases this is root. When the container exits and we try to delete them we can't because
          # root owns those files. We expect this to happen, so we handle EACCESS. Any other error
          # we will raise the exception up.
          if exc.errno == errno.EACCES:
              logger.warning(
                  "Failed to delete: %s Please remove it manually.",
                  source,
              )
          else:
              logger.error("Failed to delete: %s", source)
              raise
  
      return final_uri
  
file_path: sagemaker-python-sdk/src/sagemaker/local/utils.py
imports: from __future__ import absolute_import
  import os
  import logging
  import shutil
  import subprocess
  import json
  import re
  import errno
  from distutils.dir_util import copy_tree
  from six.moves.urllib.parse import urlparse
  from sagemaker import s3
label_desc: Use image node_id 2 for calling a global function with example usage: move_to_destination(source, destination, job_name, sagemaker_session, prefix) and returns: final_uri