code: def instrument(html_output=False):
      """Run a statistical profiler"""
      try:
          from pyinstrument import Profiler
      except ImportError:
          print(
              "Failed to run profiler, pyinstrument is not installed"
          )  # noqa: T201
          yield
          return
  
      profiler = Profiler()
  
      profiler.start()
      try:
          yield
      finally:
          profiler.stop()
  
          if html_output:
              profiler.open_in_browser()
          else:
              print(profiler.output_text(unicode=True, color=True))
  
file_path: dvc/dvc/_debug.py
imports: from contextlib import ExitStack, contextmanager
  from datetime import datetime
  from typing import TYPE_CHECKING, Callable, Optional, Union
label_desc: Use image node_id 3 for calling a global function with example usage: instrument(html_output) without return types