def usage(ecode, msg=""):
    """
    Print usage and msg and exit with given code.
    """
    print(__doc__, file=sys.stderr)
    if msg:
        print(msg, file=sys.stderr)
    sys.exit(ecode)

    Print usage and msg and exit with given code.
    
msgfmt.py