code: def valid_replay(info, ping):
      """Make sure the replay isn't corrupt, and is worth looking at."""
      if (
          info.HasField("error")
          or info.base_build != ping.base_build
          or info.game_duration_loops < 1000  # different game version
          or len(info.player_info) != 2
      ):
          # Probably corrupt, or just not interesting.
          return False
      for p in info.player_info:
          if p.player_apm < 10 or p.player_mmr < 1000:
              # Low APM = player just standing around.
              # Low MMR = corrupt replay or player who is weak.
              return False
      return True
  
imports: import collections
  import multiprocessing
  import os
  import queue
  import signal
  import sys
  import threading
  import time
  from absl import app
  from absl import flags
  from pysc2 import run_configs
  from pysc2.lib import features
  from pysc2.lib import point
  from pysc2.lib import protocol
  from pysc2.lib import remote_controller
  from pysc2.lib import replay
  from pysc2.lib import static_data
  from pysc2.lib import gfile
  from s2clientprotocol import common_pb2
  from s2clientprotocol import sc2api_pb2
label_desc: Use image node_id 2 for calling a global function with example usage: valid_replay(info, ping) and returns: True, False, False