import pickle


def set_dict(db,key,user_dict):
    """
    Stores a python dictionary in a redis key in the given database. It does
    this by pickling the dictionary.
    """
    dict_str = pickle.dumps(user_dict)
    return db.set(key,dict_str)