def get_orthographies_by_name(engine):
    """Return a dict form orthography names to the largest id corresponding to an orthography with that name."""
    orthographies = {}
    engine.execute('set names utf8;')
    query = 'SELECT id, name FROM orthography;'
    result = engine.execute(query).fetchall()
    for id, name in result:
        orthographies.setdefault(name, []).append(id)
    for name, ids in orthographies.items():
        orthographies[name] = max(ids)
    return orthographies