code: def _collect_coverage():
      dist_coverage_path = os.path.join(MARS_ROOT, ".dist-coverage")
      if os.path.exists(dist_coverage_path):
          # change ownership of coverage files
          if find_executable("sudo"):
              proc = subprocess.Popen(
                  [
                      "sudo",
                      "-n",
                      "chown",
                      "-R",
                      f"{os.geteuid()}:{os.getegid()}",
                      dist_coverage_path,
                  ],
                  shell=False,
              )
              proc.wait()
  
          # rewrite paths in coverage result files
          for fn in glob.glob(
              os.path.join(dist_coverage_path, ".coverage.*")
          ):
              if "COVERAGE_FILE" in os.environ:
                  new_cov_file = os.environ[
                      "COVERAGE_FILE"
                  ] + os.path.basename(fn).replace(".coverage", "")
              else:
                  new_cov_file = fn.replace(
                      ".dist-coverage" + os.sep, ""
                  )
              shutil.copyfile(fn, new_cov_file)
          shutil.rmtree(dist_coverage_path)
  
imports: import glob
  import os
  import shutil
  import subprocess
  import tempfile
  import uuid
  from contextlib import contextmanager
  from distutils.spawn import find_executable
  import numpy
  import pytest
  from ....None import tensor
  from ....tests.core import mock
  from ..None import new_cluster
  from ..config import HostPathVolumeConfig
label_desc: Use image node_id 1 for calling a global function with example usage: _collect_coverage() without return types