code: def flight_server(self, scenario_name=None):
      cmd = _FLIGHT_SERVER_CMD + ["-port=0"]
      if scenario_name:
          cmd = cmd + ["-scenario", scenario_name]
      if self.debug:
          log(" ".join(cmd))
      server = subprocess.Popen(
          cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
      )
  
      try:
          output = server.stdout.readline().decode()
          if not output.startswith("Server listening on localhost:"):
              server.kill()
              out, err = server.communicate()
              raise RuntimeError(
                  "Flight-Go server did not start properly, "
                  "stdout: \n{}\n\nstderr:\n{}\n".format(
                      output + out.decode(), err.decode()
                  )
              )
          port = int(output.split(":")[1])
          yield port
      finally:
          server.kill()
          server.wait(5)
  
imports: import contextlib
  import functools
  import os
  import subprocess
  from .None import cdata
  from .tester import Tester, CDataExporter, CDataImporter
  from .util import run_cmd, log
  from ..utils.source import ARROW_ROOT_DEFAULT
label_desc: Use image node_id 6 for calling the GoTester obj's underlying member method code with example usage: obj.flight_server(scenario_name) without return types