docs: def run_game(load_file, selfplay_dir=None, holdout_dir=None,
               sgf_dir=None, holdout_pct=0.05):
      """Takes a played game and record results and game data."""
      if sgf_dir is not None:
          minimal_sgf_dir = os.path.join(sgf_dir, 'clean')
          full_sgf_dir = os.path.join(sgf_dir, 'full')
          utils.ensure_dir_exists(minimal_sgf_dir)
          utils.ensure_dir_exists(full_sgf_dir)
      if selfplay_dir is not None:
          utils.ensure_dir_exists(selfplay_dir)
          utils.ensure_dir_exists(holdout_dir)
  
      with utils.logged_timer("Loading weights from %s ... " % load_file):
          network = dual_net.DualNetwork(load_file)
  
      with utils.logged_timer("Playing game"):
          player = play(network)
  
      output_name = '{}-{}'.format(int(time.time()), socket.gethostname())
      game_data = player.extract_data()
      if sgf_dir is not None:
          with gfile.GFile(os.path.join(minimal_sgf_dir, '{}.sgf'.format(output_name)), 'w') as f:
              f.write(player.to_sgf(use_comments=False))
          with gfile.GFile(os.path.join(full_sgf_dir, '{}.sgf'.format(output_name)), 'w') as f:
              f.write(player.to_sgf())
  
      tf_examples = preprocessing.make_dataset_from_selfplay(game_data)
  
      if selfplay_dir is not None:
          # Hold out 5% of games for validation.
          if random.random() < holdout_pct:
              fname = os.path.join(holdout_dir,
                                   "{}.tfrecord.zz".format(output_name))
          else:
              fname = os.path.join(selfplay_dir,
                                   "{}.tfrecord.zz".format(output_name))
  
          preprocessing.write_tf_examples(fname, tf_examples)