parser is used to grab the arguments you pass to run the script from e.g. a terminal:
python script.py --dataroot /my/path/to/images

This will add the provided path to args.dataroot after you’ve called args = parser.parse_args().