1import os
2import sys
3
4def _write_message(kind, message):
5    program = os.path.basename(sys.argv[0])
6    sys.stderr.write('%s: %s: %s\n' % (program, kind, message))
7
8note = lambda message: _write_message('note', message)
9warning = lambda message: _write_message('warning', message)
10error = lambda message: _write_message('error', message)
11fatal = lambda message: (_write_message('fatal error', message), sys.exit(1))
12
13__all__ = ['note', 'warning', 'error', 'fatal']
14