def insert_user(cursor,username,hash_pw):
    """
    Insert a new user in the database

    Parameters:
    -----------
    cursor: Psycopg2 cursor
        Cursor of type RealDict in the postgres database
    username : Str
        name of the user
    hash_pw : Str 
        encrypted password of the user (to be tested against the encrypted password) 

    Returns:
    --------
    id : Int
        identifier of the inserted user
    """
    SQL = "INSERT INTO users(username, password_hash) VALUES(%s,%s) RETURNING id"
    cursor.execute(SQL,[username,hash_pw])
    res = cursor.fetchone()['id']
    return res