from typing import Counter


def _count_elements(species, stoich):
    """Total the number of elements

    Parameters
    ----------
        species : list of pmutt model objects
            Species to count the elements
        stoich : list of float
            Stoichiometric coefficients of each element
    Returns
    -------
        element_count : collections.Counter object
            Sum of elements
    """
    element_count = Counter()
    for specie, stoich_specie in zip(species, stoich):
        for element, coeff in specie.elements.items():
            element_count += Counter({element: coeff * stoich_specie})
    return element_count