debug output goes to stderr so you can still redirect the stdout to a file
    or another program. Controlled by the JUT_DEBUG environment variable being
    present

def debug(message, *args, **kwargs):
    """
    debug output goes to stderr so you can still redirect the stdout to a file
    or another program. Controlled by the JUT_DEBUG environment variable being
    present

    """
    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()