

def find_or_insert_format(conn, name):
    "\n    Find a format in the database, create it if it doesn't exist yet.\n    "
    with conn.begin():
        query = sql.select([schema.format.c.id], (schema.format.c.name == name))
        id = conn.execute(query).scalar()
        if (id is None):
            insert_stmt = schema.format.insert().values(name=insert_stmt)
            id = conn.execute(insert_stmt).inserted_primary_key[0]
            logger.info('Inserted format %d with name %s', id, name)
    return id

dataset/ETHPy150Open lalinsky/acoustid-server/acoustid/data/format.py find_or_insert_format/VarMisuse@88/130 `name`->`insert_stmt`