def add_db(source_socket, destination_socket, source_db, destination_db):
    src = redis_conn(source_socket, source_db)
    dest = redis_conn(destination_socket, destination_db)
    keys = src.keys()
    for key in keys:
        key_type = src.type(key)
        if key_type == "string":
            value = src.get(key)
            if dest.exists(key):
                try:
                    float_val = float(value)
                    incr_by_float(dest, key, float_val)
                except ValueError:
                    raise NotANumber(key, value)
            else:
                dest.set(key, value)
        elif key_type == "set":
            value = src.smembers(key)
            for sval in value:
                dest.sadd(key, sval)
        elif key_type == "hash":
            value = src.hgetall(key)
            if dest.exists(key):
                for hkey, hval in value.iteritems():
                    if dest.hexists(key, hkey):
                        try:
                            float_val = float(hval)
                            hincr_by_float(dest, key, hkey, float_val)
                        except __HOLE__:
                            raise NotANumber("->".join([key, hkey]), hval)
                    else:
                        dest.hset(key, hkey, hval)
            else:
                for hkey, hval in value.iteritems():
                    dest.hset(key, hkey, hval)
        else:
            raise UnsupportedKeyType(key_type, key)
dataset/ETHPy150Open practo/r5d4/scripts/add_keys.py/add_db