def lang_exists(cursor, lang):
    """Checks if language exists for db"""
    query = 'SELECT lanname FROM pg_language WHERE lanname = %(lang)s'
    cursor.execute(query, {'lang': lang})
    return cursor.rowcount > 0
