code: def handle_magic_line(line, cell, parser, namespace=None):
    
    try:
      args, cell = parser.parse(line, cell, namespace)
      if args:
        return args['func'](args, cell)
    except Exception as e:
      # e.args[0] is 'exit_0' if --help is provided in line.
      # In this case don't write anything to stderr.
      if e.args and e.args[0] == 'exit_0':
        return
      sys.stderr.write('\n' + str(e))
      sys.stderr.flush()
docs: Helper function for handling magic command lines given a parser with handlers set.