code: def track_to_new_artifact(
      swagger_client: SwaggerClientWrapper,
      project_id: str,
      path: List[str],
      parent_identifier: str,
      entries: List[Tuple[str, Optional[str]]],
      default_request_params: Dict,
      exclude_directory_files: bool,
      exclude_metadata_from_hash: bool,
  ) -> Optional[Operation]:
      files: List[ArtifactFileData] = _extract_file_list(path, entries)
  
      if exclude_directory_files:
          files = _filter_empty_directory_files(files)
  
      if not files:
          raise ArtifactUploadingError("Uploading an empty Artifact")
  
      artifact_hash = (
          _compute_artifact_hash_without_metadata(files)
          if exclude_metadata_from_hash
          else _compute_artifact_hash(files)
      )
  
      artifact = create_new_artifact(
          swagger_client=swagger_client,
          project_id=project_id,
          artifact_hash=artifact_hash,
          parent_identifier=parent_identifier,
          size=_compute_artifact_size(files),
          default_request_params=default_request_params,
      )
  
      if not artifact.received_metadata:
          upload_artifact_files_metadata(
              swagger_client=swagger_client,
              project_id=project_id,
              artifact_hash=artifact_hash,
              files=files,
              default_request_params=default_request_params,
          )
  
      return AssignArtifact(path=path, hash=artifact_hash)
  
imports: from typing import Dict, List, Optional, Tuple, Type
  from bravado.exception import HTTPNotFound
  from neptune.common.backends.utils import with_api_exceptions_handler
  from neptune.exceptions import ArtifactNotFoundException, ArtifactUploadingError, FetchAttributeNotFoundException, NeptuneEmptyLocationException
  from neptune.internal.artifacts.file_hasher import FileHasher
  from neptune.internal.artifacts.types import ArtifactDriver, ArtifactDriversMap, ArtifactFileData
  from neptune.internal.backends.api_model import ArtifactAttribute, ArtifactModel
  from neptune.internal.backends.swagger_client_wrapper import SwaggerClientWrapper
  from neptune.internal.operation import AssignArtifact, Operation
  from neptune.internal.utils.paths import path_to_str
label_desc: Use image node_id 4 for calling a global function with example usage: track_to_new_artifact(swagger_client, project_id, path, parent_identifier, entries, default_request_params, exclude_directory_files, exclude_metadata_from_hash) and returns: AssignArtifact