def find_element(el, *, elements, select_all_elements="all"):
    """
    Find element (e.g. ``'Ca'``) or an emission line (e.g. ``'Ca_K'``) in the list of emission lines
    (e.g. ``['Ca_K', 'Si_K]``).  The function returns the index of the first element
    of the list ``elements`` that starts from ``el``.

    Parameters
    ----------
    el: str
        Element
    elements: list(str)
        The list of elements
    select_all_elements: str
        If ``el`` is equal to ``select_all_elements``, then return the total number of elements in the list

    Returns
    -------
    int or None
        Returns integer index of the element if an element is found, the number of elements in the list if
        ``el == select_all_elements`` or ``None`` if the element is not found.
    """

    if el == select_all_elements:
        return len(elements)

    el_ind = None
    for i, elem in enumerate(elements):
        if elem.startswith(el):
            el_ind = i
            break

    if el_ind is None:
        raise IndexError(f"Element '{el}' is not found in the list {elements}")

    return el_ind