def METHOD_NAME(argv):
    loglevels = [
        logging.CRITICAL,
        logging.ERROR,
        logging.WARN,
        logging.INFO,
        logging.DEBUG,
    ]
    parser = argparse.ArgumentParser(argv)
    parser.add_argument(
        "-v",
        "--verbosity",
        type=int,
        default=4,
        help="set logging verbosity, 1=CRITICAL, 5=DEBUG",
    )
    parser.add_argument("tty", help="Serial port device file name")
    parser.add_argument(
        "-b", "--baudrate", default=115200, type=int, help="Serial port baudrate"
    )
    args = parser.parse_args()
    # logging setup
    logging.basicConfig(level=loglevels[args.verbosity - 1])
    # open serial port
    try:
        logging.debug("Open serial port %s, baud=%d", args.tty, args.baudrate)
        port = serial.Serial(
            port=args.tty, baudrate=9600, dsrdtr=0, rtscts=0, timeout=0.3
        )
        # This baudrate reconfiguration is necessary for certain USB to serial
        # adapters, the Linux cdc_acm driver will keep repeating stale buffer
        # contents otherwise. No idea about the cause, but this fixes the symptom.
        port.baudrate = args.baudrate
    except IOError:
        logging.critical("error opening serial port", file=sys.stderr)
        sys.exit(2)
    try:
        logging.debug("Creating figure")
        fig, ax = plt.subplots()
        graph = RSSIPlot(ax)
        emitter = SpectrumEmitter(port)
        animation.FuncAnimation(
            fig, graph.update, emitter.data_gen, interval=10, blit=True
        )
        plt.show()
    except KeyboardInterrupt:
        port.close()
        sys.exit(2)