code: def prepare_trial_working_dir(
      experiment_client: ExperimentClient, trial: Trial
  ) -> None:
      """Prepare working directory of a trial.
  
      This will create a working directory based on ``trial.working_dir`` if not already existing. If
      the trial has a parent, the ``working_dir`` of the parent will be copied to the ``working_dir``
      of the current trial.
  
      Parameters
      ----------
      experiment_client: orion.client.experiment.ExperimentClient
          The experiment client being executed.
      trial: orion.core.worker.trial.Trial
          The trial that will be executed.
  
      Raises
      ------
      ``ValueError``
          If the parent is not found in the storage of ``experiment_client``.
  
      """
      backward.ensure_trial_working_dir(experiment_client, trial)
  
      # TODO: Test that this works when resuming a trial.
      if os.path.exists(trial.working_dir):
          return
  
      if trial.parent:
          parent_trial = experiment_client.get_trial(uid=trial.parent)
          if parent_trial is None:
              raise ValueError(
                  f"Parent id {trial.parent} not available in storage. (From trial {trial.id})"
              )
          shutil.copytree(parent_trial.working_dir, trial.working_dir)
      else:
          os.makedirs(trial.working_dir)
  
imports: from __future__ import annotations
  import logging
  import os
  import shutil
  import signal
  import time
  import typing
  import warnings
  from contextlib import contextmanager
  from dataclasses import dataclass
  from typing import Callable
  import orion.core
  from orion.core.utils import backward
  from orion.core.utils.exceptions import BrokenExperiment, CompletedExperiment, InvalidResult, LazyWorkers, ReservationRaceCondition, WaitingForTrials
  from orion.core.utils.flatten import flatten, unflatten
  from orion.core.worker.consumer import ExecutionError
  from orion.core.worker.trial import AlreadyReleased
  from orion.executor.base import AsyncException, AsyncResult
  from orion.storage.base import LockAcquisitionTimeout
label_desc: Use image node_id 3 for calling a global function with example usage: prepare_trial_working_dir(experiment_client, trial) without return types