def find_or_create_location(location, dbh):
    """Find or create the location"""

    cur = dbh.cursor()
    cur.execute('select location_id from location where name = %s', (location, ))
    res = cur.fetchone()
    location_id = 0

    if res is None:
        print(f'Loading location "{location}"')
        cur.execute('insert into location (name) values (%s)', (location, ))
        location_id = cur.lastrowid
        dbh.commit()
    else:
        location_id = res[0]

    return location_id