class_docstr: Magics related to code execution, debugging, profiling, etc.
  
      
docstr: Run `code` with profiler.  Used by ``%prun`` and ``%run -p``.
  
  Parameters
  ----------
  code : str
      Code to be executed.
  opts : Struct
      Options parsed by `self.parse_options`.
  namespace : dict
      A dictionary for Python namespace (e.g., `self.shell.user_ns`).
docstr_tok: ["Run","`","code","`","with","profiler",".","Used","by","``","%","prun","``","and","``","%","run","-p","``",".","Parameters","--","--","--","--","--","code",":","str","Code","to","be","executed",".","opts",":","Struct","Options","parsed","by","`","self.parse_options","`",".","namespace",":","dict","A","dictionary","for","Python","namespace","(","e.g.",",","`","self.shell.user_ns","`",")","."]
code: def _run_with_profiler(self, code, opts, namespace):
      """
      Run `code` with profiler.  Used by ``%prun`` and ``%run -p``.
  
      Parameters
      ----------
      code : str
          Code to be executed.
      opts : Struct
          Options parsed by `self.parse_options`.
      namespace : dict
          A dictionary for Python namespace (e.g., `self.shell.user_ns`).
  
      """
  
      # Fill default values for unspecified options:
      opts.merge(Struct(D=[""], l=[], s=["time"], T=[""]))
  
      prof = profile.Profile()
      try:
          prof = prof.runctx(code, namespace, namespace)
          sys_exit = ""
      except SystemExit:
          sys_exit = """*** SystemExit exception caught in code being profiled."""
  
      stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
  
      lims = opts.l
      if lims:
          lims = []  # rebuild lims with ints/floats/strings
          for lim in opts.l:
              try:
                  lims.append(int(lim))
              except ValueError:
                  try:
                      lims.append(float(lim))
                  except ValueError:
                      lims.append(lim)
  
      # Trap output.
      stdout_trap = StringIO()
      stats_stream = stats.stream
      try:
          stats.stream = stdout_trap
          stats.print_stats(*lims)
      finally:
          stats.stream = stats_stream
  
      output = stdout_trap.getvalue()
      output = output.rstrip()
  
      if "q" not in opts:
          page.page(output)
      print(sys_exit, end=" ")
  
      dump_file = opts.D[0]
      text_file = opts.T[0]
      if dump_file:
          prof.dump_stats(dump_file)
          print(
              "\n*** Profile stats marshalled to file",
              repr(dump_file) + ".",
              sys_exit,
          )
      if text_file:
          pfile = open(text_file, "w")
          pfile.write(output)
          pfile.close()
          print(
              "\n*** Profile printout saved to text file",
              repr(text_file) + ".",
              sys_exit,
          )
  
      if "r" in opts:
          return stats
      else:
          return None
  
imports: from __future__ import print_function
  from __future__ import absolute_import
  import ast
  import bdb
  import gc
  import itertools
  import os
  import sys
  import time
  import timeit
  from pdb import Restart
  from IPython.core import oinspect
  from IPython.core import magic_arguments
  from IPython.core import page
  from IPython.core.error import UsageError
  from IPython.core.macro import Macro
  from IPython.core.magic import Magics, magics_class, line_magic, cell_magic, line_cell_magic, on_off, needs_local_scope
  from IPython.testing.skipdoctest import skip_doctest
  from IPython.utils import py3compat
  from IPython.utils.py3compat import builtin_mod, iteritems, PY3
  from IPython.utils.contexts import preserve_keys
  from IPython.utils.capture import capture_output
  from IPython.utils.ipstruct import Struct
  from IPython.utils.module_paths import find_mod
  from IPython.utils.path import get_py_filename, shellglob
  from IPython.utils.timing import clock, clock2
  from warnings import warn
  from logging import error
label_desc: Use image node_id 4 for calling the ExecutionMagics obj's underlying member method code with example usage: obj._run_with_profiler(code, opts, namespace) and returns: stats, None