def debug(message, *args, **kwargs):
    if 'end' in kwargs:
        end = kwargs['end']
    else:
        end = '\n'

    if DEBUG: 
        if len(args) == 0:
            sys.stderr.write(message)
        else:
            sys.stderr.write(message % args)

        sys.stderr.write(end)
        sys.stderr.flush()
debug output goes to stderr so you can still redirect the stdout to a file
dataset/ETHPy150Open jut-io/jut-python-tools/jut/common.py/debug