def get_index(l, key, value):
    """Find the index of an element by key value, for lists of dicts
    Return: index or -1
    """
    return next((index for index, d in enumerate(l) if d[key] == value), -1)