code: def _create_episode(
      active_episodes, env_id, callbacks, worker, base_env
  ):
      # Make sure we are really creating a new episode here.
      assert env_id not in active_episodes
  
      # Create a new episode under the given `env_id` and call the
      # `on_episode_created` callbacks.
      new_episode = active_episodes[env_id]
      # Call `on_episode_created()` callback.
      callbacks.on_episode_created(
          worker=worker,
          base_env=base_env,
          policies=worker.policy_map,
          env_index=env_id,
          episode=new_episode,
      )
      return new_episode
  
imports: import logging
  import queue
  import time
  from abc import ABCMeta, abstractmethod
  from collections import defaultdict, namedtuple
  from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
  import numpy
  import tree
  from ray.rllib.env.base_env import ASYNC_RESET_RETURN, BaseEnv, convert_to_base_env
  from ray.rllib.evaluation.collectors.sample_collector import SampleCollector
  from ray.rllib.evaluation.collectors.simple_list_collector import SimpleListCollector
  from ray.rllib.evaluation.env_runner_v2 import EnvRunnerV2, _fetch_atari_metrics, _get_or_raise, _PerfStats
  from ray.rllib.evaluation.episode import Episode
  from ray.rllib.evaluation.metrics import RolloutMetrics
  from ray.rllib.offline import InputReader
  from ray.rllib.policy.policy import Policy
  from ray.rllib.policy.policy_map import PolicyMap
  from ray.rllib.policy.sample_batch import SampleBatch, concat_samples
  from ray.rllib.utils.annotations import DeveloperAPI, override
  from ray.rllib.utils.debug import summarize
  from ray.rllib.utils.deprecation import deprecation_warning, DEPRECATED_VALUE
  from ray.rllib.utils.framework import try_import_tf
  from ray.rllib.utils.numpy import convert_to_numpy, make_action_immutable
  from ray.rllib.utils.spaces.space_utils import clip_action, unbatch, unsquash_action
  from ray.rllib.utils.typing import AgentID, EnvActionType, EnvID, EnvInfoDict, EnvObsType, MultiEnvDict, PolicyID, SampleBatchType, TensorStructType
  from ray.util.debug import log_once
label_desc: Use image node_id 5 for calling a global function with example usage: _create_episode(active_episodes, env_id, callbacks, worker, base_env) and returns: new_episode