code: def only_in_game(func):
      @functools.wraps(func)
      def decorator(self, *args, **kwargs):
          if self.in_game:  # pytype: disable=attribute-error
              return func(self, *args, **kwargs)
  
      return decorator
  
imports: import functools
  from absl import logging
  from absl.testing import absltest
  from pysc2 import maps
  from pysc2 import run_configs
  from pysc2.lib import actions
  from pysc2.lib import features
  from pysc2.lib import point
  from pysc2.lib import portspicker
  from pysc2.lib import run_parallel
  from pysc2.lib import stopwatch
  from s2clientprotocol import common_pb2
  from s2clientprotocol import debug_pb2
  from s2clientprotocol import error_pb2
  from s2clientprotocol import raw_pb2
  from s2clientprotocol import sc2api_pb2
label_desc: Use image node_id 4 for calling a global function with example usage: only_in_game(func) and returns: decorator, func