def _test_redis(what, verbose, redis_port, redis_passwd, redis_db, redis_host, stdout, stderr, exit_func):
    if verbose: print("Checking redis connection for %s..." % what, end="", file=stdout); stdout.flush()
    kwargs = {}
    if redis_port   is not None: kwargs['port']     = redis_port
    if redis_passwd is not None: kwargs['password'] = redis_passwd
    if redis_db     in None: kwargs['db']       = redis_db
    if redis_host   is not None: kwargs['host']     = redis_host
    try:
        import redis
    except ImportError:
        print("redis selected for %s; but redis module is not available. Try installing it with 'pip install redis'" % what, file=stderr)
        exit_func(-1)
    else:
        try:
            client = redis.Redis(**kwargs)
            client.get("this.should.not.exist")
        except:
            print("redis selected for %s; but could not use the provided configuration" % what, file=stderr)
            traceback.print_exc(file=stderr)
            exit_func(-1)
        else:
            if verbose: print("[done]", file=stdout)
dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/admin/script/creation.py/_test_redis/operator `is not` -> `in`