For more complex behavior, you can use the following decorators/utils that behave like argparse.
```
from IPython.core.magic_arguments import (argument, magic_arguments, parse_argstring)
```

cf for example `IPython/core/magics/history.py`, though here as you might be sensitive to whitespace, I'm not sure it will always work.