code: def dir_server():
      with tmpdir() as d:
          for fn in files:
              with open(os.path.join(d, fn), "wb") as f:
                  f.write(b"a" * 10000)
  
          cmd = [sys.executable, "-m", "http.server", "8999"]
          p = subprocess.Popen(cmd, cwd=d)
          timeout = 10
          while True:
              try:
                  requests.get("http://localhost:8999")
                  break
              except requests.exceptions.ConnectionError as e:
                  time.sleep(0.1)
                  timeout -= 0.1
                  if timeout < 0:
                      raise RuntimeError("Server did not appear") from e
          yield d
          p.terminate()
  
imports: from __future__ import annotations
  import os
  import subprocess
  import sys
  import time
  import fsspec
  import pytest
  from fsspec.core import open_files
  from packaging.version import parse
  import dask.bag
  from dask.utils import tmpdir
label_desc: Use image node_id 1 for calling a global function with example usage: dir_server() without return types