<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_oxidation_state_by_site(self, oxidation_states):
 """ Add oxidation states to a structure by site. Args: oxidation_states (list):
 List of oxidation states. E.g., [1, 1, 1, 1, 2, 2, 2, 2, 5, 5, 5, 5, -2, -2, -2, -2] """

        if len(oxidation_states) != len(self.sites):
            raise ValueError("Oxidation states of all sites must be "
                             "specified.")
        for site, ox in zip(self.sites, oxidation_states):
            new_sp = {}
            for el, occu in site.species.items():
                sym = el.symbol
                new_sp[Specie(sym, ox)] = occu
            site.species = new_sp