def index_sites(structure, species=None, labels=None):
    """
    Return a list of the site indices in a structure that are occupied by specie or label (or both)

     Args:
         - structure (Structure): pymatgen structure object
         - species   ({str}): site species to count
         - label     ({str}): site label to count

     Returns:
         - ([int]): list with site indices occupied by species or label (or both) in structure

    """
    if labels and species:
        return [
            i
            for i, site in enumerate(structure)
            if ((site.label in labels) and (site.species_string in species))
        ]
    elif species and not labels:
        return [i for i, site in enumerate(structure) if site.species_string in species]
    elif labels and not species:
        return [i for i, site in enumerate(structure) if site.label in labels]
    else:
        raise ValueError("Need to supply either specie, or label to index_sites")