code: def convert_to_test_data(
      tests: List[Any],
      vw_bin: str,
      spanning_tree_bin: Optional[Path],
      skipped_ids: List[int],
      skip_network_tests: bool,
      extra_vw_options: str,
  ) -> List[TestData]:
      results: List[TestData] = []
      for test in tests:
          skip = False
          skip_reason = None
          is_shell = False
          command_line = ""
          if "bash_command" in test:
              command_line = test["bash_command"].format(
                  VW=vw_bin, SPANNING_TREE=spanning_tree_bin
              )
              is_shell = True
  
              if sys.platform == "darwin" and (
                  "daemon" in test["bash_command"]
                  or "spanning_tree" in test["bash_command"]
                  or "sender_test.py" in test["bash_command"]
                  or "active_test.py" in test["bash_command"]
              ):
                  skip = True
                  skip_reason = (
                      "daemon not currently supported in MacOS"
                  )
              elif sys.platform == "win32":
                  skip = True
                  skip_reason = "bash_command is unsupported on Windows"
  
              if spanning_tree_bin is None and (
                  "SPANNING_TREE" in test["bash_command"]
                  or "spanning_tree" in test["bash_command"]
              ):
                  skip = True
                  skip_reason = "Test using spanning_tree skipped because of --skip_spanning_tree_tests argument"
  
              if skip_network_tests and (
                  "daemon" in test["bash_command"]
                  or "spanning_tree" in test["bash_command"]
                  or "sender_test.py" in test["bash_command"]
                  or "active_test.py" in test["bash_command"]
              ):
                  skip = True
                  skip_reason = "Tests requiring daemon or network skipped because of --skip_network_tests argument"
          elif "vw_command" in test:
              command_line = (
                  f"{vw_bin} {test['vw_command']} {extra_vw_options}"
              )
          else:
              skip = True
              skip_reason = "This test is an unknown type"
  
          if test["id"] in skipped_ids:
              skip = True
              skip_reason = "Test skipped by --skip_test argument"
  
          results.append(
              TestData(
                  id=test["id"],
                  description=test["desc"] if "desc" in test else "",
                  depends_on=test["depends_on"]
                  if "depends_on" in test
                  else [],
                  command_line=command_line,
                  is_shell=is_shell,
                  input_files=test["input_files"]
                  if "input_files" in test
                  else [],
                  comparison_files=test["diff_files"]
                  if "diff_files" in test
                  else dict(),
                  skip=skip,
                  skip_reason=skip_reason,
              )
          )
      return results
  
imports: import shutil
  import threading
  import argparse
  import difflib
  from pathlib import Path
  import re
  import os
  import subprocess
  import sys
  import traceback
  import shlex
  import math
  import json
  from concurrent.futures import ThreadPoolExecutor, Future
  from enum import Enum
  import socket
  from typing import Any, Callable, Dict, List, Mapping, Optional, Set, Tuple, Type, Union, cast
  from run_tests_common import TestData
  import runtests_flatbuffer_converter
label_desc: Use image node_id 23 for calling a global function with example usage: convert_to_test_data(tests, vw_bin, spanning_tree_bin, skipped_ids, skip_network_tests, extra_vw_options) and returns: results