code: def get_profile_context(
      enable_flag, warmup_steps, active_steps, save_dir
  ):
      if enable_flag:
          return profile(
              activities=[ProfilerActivity.CPU, ProfilerActivity.CUDA],
              schedule=schedule(
                  wait=0, warmup=warmup_steps, active=active_steps
              ),
              on_trace_ready=tensorboard_trace_handler(save_dir),
              record_shapes=True,
              profile_memory=True,
          )
      else:
          return nullcontext(DummyProfiler())
  
file_path: ColossalAI/examples/language/gpt/gemini/commons/utils.py
imports: import time
  from contextlib import nullcontext
  import torch
  from torch.profiler import ProfilerActivity, profile, schedule, tensorboard_trace_handler
label_desc: Use image node_id 3 for calling a global function with example usage: get_profile_context(enable_flag, warmup_steps, active_steps, save_dir) and returns: profile, nullcontext