class_docstr: PySC2 environment converter.
  
  Converts the PySC2 observation/action interface, supporting more standard
  interaction with an ML agent and providing enriched observations.
  
  Limited configuration is supported through the `ConverterSettings` proto.
  In particular, clients may choose between 'visual' and 'raw' interfaces.
  The visual interface focuses on spatial features and actions which are close
  to those used by a human when playing the game. The raw interface retains
  some spatial features but focuses on numeric unit data; actions being
  specified to units directly, ignoring e.g. the position of the camera.
  
  The converter maintains some state throughout an episode. This state relies
  on convert_observation and convert_action being called alternately
  throughout the episde. A new converter should be created for each episode.
docstr: Converts a SC2 API observation, enriching it with additional info.
  
  Args:
    observation: Proto containing the SC2 API observation proto for the
      player, and potentially for his opponent. When operating in supervised
      mode must also contain the action taken by the player in response to
      this observation.
  
  Returns:
    A flat mapping of string labels to numpy arrays / or scalars, as
    appropriate.
docstr_tok: ["Converts","a","SC2","API","observation",",","enriching","it","with","additional","info",".","Args",":","observation",":","Proto","containing","the","SC2","API","observation","proto","for","the","player",",","and","potentially","for","his","opponent",".","When","operating","in","supervised","mode","must","also","contain","the","action","taken","by","the","player","in","response","to","this","observation",".","Returns",":","A","flat","mapping","of","string","labels","to","numpy","arrays","\/","or","scalars",",","as","appropriate","."]
code: def convert_observation(
      self, observation: converter_pb2.Observation
  ) -> Mapping[str, Any]:
      """Converts a SC2 API observation, enriching it with additional info.
  
      Args:
        observation: Proto containing the SC2 API observation proto for the
          player, and potentially for his opponent. When operating in supervised
          mode must also contain the action taken by the player in response to
          this observation.
  
      Returns:
        A flat mapping of string labels to numpy arrays / or scalars, as
        appropriate.
      """
      serialized_converted_obs = self._converter.ConvertObservation(
          observation.SerializeToString()
      )
  
      deserialized_converted_obs = {}
      for k, v in serialized_converted_obs.items():
          value = dm_env_rpc_pb2.Tensor()
          value.ParseFromString(v)
          try:
              unpacked_value = tensor_utils.unpack_tensor(value)
              deserialized_converted_obs[k] = unpacked_value
          except Exception as e:
              raise Exception(f"Unpacking failed for {k}:{v} - {e}")
  
      return deserialized_converted_obs
  
file_path: pysc2/pysc2/env/converter/converter.py
imports: from typing import Any, Mapping
  from dm_env import specs
  from pysc2.env.converter.cc.python import converter
  from pysc2.env.converter.proto import converter_pb2
  from dm_env_rpc.v1 import dm_env_rpc_pb2
  from dm_env_rpc.v1 import dm_env_utils
  from dm_env_rpc.v1 import tensor_utils
  from s2clientprotocol import sc2api_pb2
label_desc: Use image node_id 4 for calling the Converter obj's underlying member method code with example usage: obj.convert_observation(observation) and returns: deserialized_converted_obs