code: def parse_env_id(id: str) -> Tuple[Optional[str], str, Optional[int]]:
      """Parse environment ID string format.
  
      This format is true today, but it's *not* an official spec.
      [namespace/](env-name)-v(version)    env-name is group 1, version is group 2
  
      2016-10-31: We're experimentally expanding the environment ID format
      to include an optional namespace.
  
      Args:
          id: The environment id to parse
  
      Returns:
          A tuple of environment namespace, environment name and version number
  
      Raises:
          Error: If the environment id does not a valid environment regex
      """
      match = ENV_ID_RE.fullmatch(id)
      if not match:
          raise error.Error(
              f"Malformed environment ID: {id}."
              f"(Currently all IDs must be of the form [namespace/](env-name)-v(version). (namespace is optional))"
          )
      namespace, name, version = match.group(
          "namespace", "name", "version"
      )
      if version is not None:
          version = int(version)
  
      return namespace, name, version
  
imports: import contextlib
  import copy
  import difflib
  import importlib
  import importlib.util
  import re
  import sys
  import warnings
  from dataclasses import dataclass, field
  from typing import Callable, Dict, List, Optional, Sequence, SupportsFloat, Tuple, Union, overload
  import numpy
  from gym.wrappers import AutoResetWrapper, HumanRendering, OrderEnforcing, RenderCollection, TimeLimit
  from gym.wrappers.compatibility import EnvCompatibility
  from gym.wrappers.env_checker import PassiveEnvChecker
  from gym import Env, error, logger
label_desc: Use image node_id 2 for calling a global function with example usage: parse_env_id(id) and returns: namespace,  name,  version