Use argparse, not the deprecated optparse.  Also, PEP8 imports are in the wrong order and grouping here.