def StartShell(local_vars, banner='', try_ipython=True):
  """ Start a shell, with the given local variables. It prints the given
  banner as a welcome message."""

  def IPythonShell(namespace, banner):
    from IPython.Shell import IPShell
    ipshell = IPShell(user_ns = namespace)
    ipshell.mainloop(banner=banner)

  def PythonShell(namespace, banner):
    import readline, rlcompleter, code
    readline.parse_and_bind("tab: complete")
    readline.set_completer(rlcompleter.Completer(namespace).complete)
    code.interact(local=namespace, banner=banner)

  if try_ipython:
    try:
      IPythonShell(local_vars, banner)
      return
    except __HOLE__ as e:
      pass
  else:
    PythonShell(local_vars, banner)
  return
dataset/ETHPy150Open spranesh/Redhawk/redhawk/utils/util.py/StartShell