def _parse_args(args):
    """
    Process the gnuplot line magic arguments
    """
    if len(args) > 1:
        raise TypeError()
    sargs = args[0].split()
    backend = sargs[0]
    if backend == 'inline':
        try:
            termspec = ' '.join(sargs[1:])
            terminal = sargs[1]
        except IndexError:
            termspec = None
            terminal = None
    else:
        termspec = args[0]
        terminal = sargs[0]
    return backend, terminal, termspec
