Switch from deprecated optparse to argparse.

Thanks Eeshan Garg for the patch!