Instead of getopt use argparse. It is strictly better.