code: def squeeze_if_necessary(x: np.ndarray) -> np.ndarray:
      """Remove the trailing 1 of inputs."""
      if x.shape and x.shape[-1] == 1:
          return np.squeeze(x, axis=-1)
      else:
          return x
  
imports: import functools
  import threading
  from typing import Any, Mapping, NamedTuple, Sequence
  import dm_env
  import numpy
  from pysc2.env.converter import converter
  from pysc2.env.converter.proto import converter_pb2
  from pysc2.lib import actions
  import tree
  import typing_extensions
  from s2clientprotocol import common_pb2
  from s2clientprotocol import raw_pb2
  from s2clientprotocol import sc2api_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: squeeze_if_necessary(x) and returns: np, x