code: def load_project(directory):
      mlproject_path = _find_mlproject(directory)
  
      # TODO: Validate structure of YAML loaded from the file
      yaml_obj = {}
      if mlproject_path is not None:
          with open(mlproject_path) as mlproject_file:
              yaml_obj = yaml.safe_load(mlproject_file)
  
      # Validate the project config does't contain multiple environment fields
      env_fields = set(yaml_obj.keys()).intersection(env_type.ALL)
      if len(env_fields) > 1:
          raise ExecutionException(
              f"Project cannot contain multiple environment fields: {env_fields}"
          )
  
      project_name = yaml_obj.get("name")
  
      # Parse entry points
      entry_points = {}
      for name, entry_point_yaml in yaml_obj.get(
          "entry_points", {}
      ).items():
          parameters = entry_point_yaml.get("parameters", {})
          command = entry_point_yaml.get("command")
          entry_points[name] = EntryPoint(name, parameters, command)
  
      # Validate config if docker_env parameter is present
      docker_env = yaml_obj.get(env_type.DOCKER)
      if docker_env:
          if not docker_env.get("image"):
              raise ExecutionException(
                  "Project configuration (MLproject file) was invalid: Docker "
                  "environment specified but no image attribute found."
              )
          if docker_env.get("volumes"):
              if not (
                  isinstance(docker_env["volumes"], list)
                  and all(
                      isinstance(i, str) for i in docker_env["volumes"]
                  )
              ):
                  raise ExecutionException(
                      "Project configuration (MLproject file) was invalid: "
                      "Docker volumes must be a list of strings, "
                      """e.g.: '["/path1/:/path1", "/path2/:/path2"])"""
                  )
          if docker_env.get("environment"):
              if not (
                  isinstance(docker_env["environment"], list)
                  and all(
                      isinstance(i, (list, str))
                      for i in docker_env["environment"]
                  )
              ):
                  raise ExecutionException(
                      "Project configuration (MLproject file) was invalid: "
                      "environment must be a list containing either strings (to copy environment "
                      "variables from host system) or lists of string pairs (to define new "
                      "environment variables)."
                      """E.g.: '[["NEW_VAR", "new_value"], "VAR_TO_COPY_FROM_HOST"])"""
                  )
          return Project(
              env_type=env_type.DOCKER,
              env_config_path=None,
              entry_points=entry_points,
              docker_env=docker_env,
              name=project_name,
          )
  
      python_env = yaml_obj.get(env_type.PYTHON)
      if python_env:
          python_env_path = os.path.join(directory, python_env)
          if not os.path.exists(python_env_path):
              raise ExecutionException(
                  "Project specified python_env file %s, but no such "
                  "file was found." % python_env_path
              )
          return Project(
              env_type=env_type.PYTHON,
              env_config_path=python_env_path,
              entry_points=entry_points,
              docker_env=None,
              name=project_name,
          )
  
      conda_path = yaml_obj.get(env_type.CONDA)
      if conda_path:
          conda_env_path = os.path.join(directory, conda_path)
          if not os.path.exists(conda_env_path):
              raise ExecutionException(
                  "Project specified conda environment file %s, but no such "
                  "file was found." % conda_env_path
              )
          return Project(
              env_type=env_type.CONDA,
              env_config_path=conda_env_path,
              entry_points=entry_points,
              docker_env=None,
              name=project_name,
          )
  
      default_python_env_path = os.path.join(
          directory, _PYTHON_ENV_FILE_NAME
      )
      if os.path.exists(default_python_env_path):
          return Project(
              env_type=env_type.PYTHON,
              env_config_path=default_python_env_path,
              entry_points=entry_points,
              docker_env=None,
              name=project_name,
          )
  
      default_conda_path = os.path.join(
          directory, DEFAULT_CONDA_FILE_NAME
      )
      if os.path.exists(default_conda_path):
          return Project(
              env_type=env_type.CONDA,
              env_config_path=default_conda_path,
              entry_points=entry_points,
              docker_env=None,
              name=project_name,
          )
  
      return Project(
          env_type=env_type.PYTHON,
          env_config_path=None,
          entry_points=entry_points,
          docker_env=None,
          name=project_name,
      )
  
imports: import os
  import yaml
  from mlflow.exceptions import ExecutionException
  from mlflow.projects import env_type
  from mlflow.tracking import artifact_utils
  from mlflow.utils import data_utils
  from mlflow.utils.environment import _PYTHON_ENV_FILE_NAME
  from mlflow.utils.file_utils import get_local_path_or_none
  from mlflow.utils.string_utils import is_string_type, quote
label_desc: Use image node_id 2 for calling a global function with example usage: load_project(directory) and returns: Project, Project, Project, Project, Project, Project