# -*- coding: utf-8 -*-

import redis


def redis_connect(conf):
    return redis.StrictRedis(**{
        'host': conf.get('HOST', 'localhost'),
        'port': conf.get('PORT', 6379),
        'password': '{}:{}'.format(conf.get('USER', ''), conf.get('PASSWORD', '')) if conf.get('USER') else '',
        'db': conf.get('db', 0),
    })
