def error(err: Exception, fatal: int=False):
    """
	Logs an error to stderr, then exits if fatal is a non-falsy value, using it as an exit code
	"""
    from sys import stderr
    from time import ctime
    if stderr.isatty():
        fmt = '\x1b[38;2;255;0;0mEE: %s:'
        print(fmt % type(err).__name__, '%s' % err, '-\t', ctime(),
            '\x1b[m', file=stderr)
    else:
        print('EE: %s:' % type(err).__name__, '%s' % err, '-\t', ctime(),
            file=stderr)
    if fatal:
        exit(int(fatal))
