code: def validate_source_dir(script, directory):
      """Validate that the source directory exists and it contains the user script.
  
      Args:
          script (str): Script filename.
          directory (str): Directory containing the source file.
      Raises:
          ValueError: If ``directory`` does not exist, is not a directory, or does
              not contain ``script``.
      """
      if directory:
          if not os.path.isfile(os.path.join(directory, script)):
              raise ValueError(
                  'No file named "{}" was found in directory "{}".'.format(
                      script, directory
                  )
              )
  
      return True
  
imports: from __future__ import absolute_import
  import json
  import logging
  import os
  import re
  import time
  import shutil
  import tempfile
  from collections import namedtuple
  from typing import List, Optional, Union, Dict
  from packaging import version
  import sagemaker.image_uris
  from sagemaker.instance_group import InstanceGroup
  from sagemaker.s3_utils import s3_path_join
  from sagemaker.session_settings import SessionSettings
  import sagemaker.utils
  from sagemaker.workflow import is_pipeline_variable
  from sagemaker.deprecations import renamed_warning, renamed_kwargs
  from sagemaker.workflow.entities import PipelineVariable
  from sagemaker.deprecations import deprecation_warn_base
label_desc: Use image node_id 1 for calling a global function with example usage: validate_source_dir(script, directory) and returns: True