code: def profile(model_specification, results_directory, process):
      
      model_specification = Path(model_specification)
      results_directory = Path(results_directory)
  
      out_stats_file = results_directory / f'{model_specification.name}'.replace('yaml', 'stats')
      command = f'run_simulation("{model_specification}", "{results_directory}")'
      cProfile.runctx(command, globals=globals(), locals=locals(), filename=out_stats_file)
  
      if process:
          out_txt_file = results_directory / (out_stats_file.name + '.txt')
          with open(out_txt_file, 'w') as f:
              p = pstats.Stats(str(out_stats_file), stream=f)
              p.sort_stats('cumulative')
              p.print_stats()
docs: Run a simulation based on the provided MODEL_SPECIFICATION and profile
      the run.