Get an ID from a user, creates if necessary

def get_id_from_user(user):
    """Get an ID from a user, creates if necessary"""
    id = r_client.hget('user-id-map', user)
    if id is None:
        id = str(uuid4())
        r_client.hset('user-id-map', user, id)
        r_client.hset('user-id-map', id, user)
    return id