<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_elemental_abunds(self,cycle,index=None):
 """ returns the elemental abundances for one cycle, either for the whole star or a specific zone depending upon the value of 'index'. Parameters cycle : string or integer Model to get the abundances for. index : integer or list, optional zone number for which to get elemental abundances. If None the entire abundance profile is returned. If a 1x2 list, the abundances are returned between indices of index[0] and index[1]. The default is None. """


        isoabunds=self.se.get(cycle,'iso_massf')
        A=array(self.se.A)
        Z=array(self.se.Z)
        names=self.se.isos
        Zuq=list(set(Z)) # list of unique Zs
        Zuq.sort()

        if index==None:
            index=[0,len(isoabunds)]

        if type(index)==list:
            elemabunds=[]
            for zone in range(index[0],index[1]):
                percent=int((zone-index[0])*100./(index[1]-index[0]))
                sys.stdout.flush()
                sys.stdout.write("\rgetting elemental abundances " + "...%d%%" % percent)

                elemabunds.append([sum(isoabunds[zone][where(Z==iZ)]) for iZ in Zuq])
        else:
            elemabunds=[sum(isoabunds[index][where(Z==iZ)]) for iZ in Zuq]

        return elemabunds