code: def _named_collection(seq: Sequence[T]) -> Dict[str, T]:
      """Convert a list into a dict, where each item is named with its type."""
      res = {}
      retry_cnt: collections.Counter = collections.Counter()
      for item in seq:
          typename = type(item).__name__.lower()
          key = (
              typename
              if retry_cnt[typename] == 0
              else f"{typename}{retry_cnt[typename]}"
          )
          retry_cnt[typename] += 1
          res[key] = item
      return res
  
imports: from __future__ import annotations
  import collections
  import copy
  from contextlib import AbstractContextManager, contextmanager
  from datetime import datetime
  from pathlib import Path
  from typing import Any, Dict, Iterable, List, OrderedDict, Sequence, TypeVar, cast
  import torch
  from qlib.log import get_module_logger
  from qlib.rl.simulator import InitialStateType
  from qlib.rl.utils import EnvWrapper, FiniteEnvType, LogBuffer, LogCollector, LogLevel, LogWriter, vectorize_env
  from qlib.rl.utils.finite_env import FiniteVectorEnv
  from qlib.typehint import Literal
  from .callbacks import Callback
  from .vessel import TrainingVesselBase
label_desc: Use image node_id 2 for calling a global function with example usage: _named_collection(seq) and returns: res