docs: def transform_action(self, obs, func_call, skip_available=False):
      """Tranform an agent-style action to one that SC2 can consume.
  
      Args:
        obs: a `sc_pb.Observation` from the previous frame.
        func_call: a `FunctionCall` to be turned into a `sc_pb.Action`.
        skip_available: If True, assume the action is available. This should only
            be used for testing or if you expect to make actions that weren't
            valid at the last observation.
  
      Returns:
        a corresponding `sc_pb.Action`.
  
      Raises:
        ValueError: if the action doesn't pass validation.
      """
      func_id = func_call.function
      try:
        func = actions.FUNCTIONS[func_id]
      except KeyError:
        raise ValueError("Invalid function id: %s." % func_id)
  
      # Available?
      if not (skip_available or func_id in self.available_actions(obs)):
        raise ValueError("Function %s/%s is currently not available" % (
            func_id, func.name))
  
      # Right number of args?
      if len(func_call.arguments) != len(func.args):
        raise ValueError(
            "Wrong number of arguments for function: %s, got: %s" % (
                func, func_call.arguments))
  
      # Args are valid?
      aif = self._agent_interface_format
      for t, arg in zip(func.args, func_call.arguments):
        if t.name in ("screen", "screen2"):
          sizes = aif.action_dimensions.screen
        elif t.name == "minimap":
          sizes = aif.action_dimensions.minimap
        else:
          sizes = t.sizes
  
        if len(sizes) != len(arg):
          raise ValueError(
              "Wrong number of values for argument of %s, got: %s" % (
                  func, func_call.arguments))
  
        for s, a in zip(sizes, arg):
          if not 0 <= a < s:
            raise ValueError("Argument is out of range for %s, got: %s" % (
                func, func_call.arguments))
  
      # Convert them to python types.
      kwargs = {type_.name: type_.fn(a)
                for type_, a in zip(func.args, func_call.arguments)}
  
      # Call the right callback to get an SC2 action proto.
      sc2_action = sc_pb.Action()
      kwargs["action"] = sc2_action
      kwargs["action_space"] = aif.action_space
      if func.ability_id:
        kwargs["ability_id"] = func.ability_id
      actions.FUNCTIONS[func_id].function_type(**kwargs)
      return sc2_action