def insert_new_product(conn, product):
    """Insert a product in the db."""

    cursor = conn.cursor()

    # execute query
    data = (product['product_name'], product['uom_id'], product['price_per_unit'])

    query = ("insert into products"
            "(name, uom_id, price_per_unit)"
            "values(%s, %s, %s);")

    cursor.execute(query, data)

    # save changes
    conn.commit()

    return cursor.lastrowid