code: def profile(dump_path: Optional[str] = None):
      """Run a cprofile"""
      import cProfile
  
      prof = cProfile.Profile()
      prof.enable()
  
      try:
          yield
      finally:
          prof.disable()
          if dump_path:
              prof.dump_stats(dump_path)
          else:
              prof.print_stats(sort="cumtime")
  
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 4 for calling a global function with example usage: profile(dump_path) without return types