<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def spectra(self, alpha=None, nmax=None, convention='power', unit='per_l', base=10.):
 """ Return the spectra of one or more Slepian functions. Usage ----- spectra = x.spectra([alpha, nmax, convention, unit, base]) Returns ------- spectra : ndarray, shape (lmax+1, nmax) A matrix with each column containing the spectrum of a Slepian function, and where the functions are arranged with increasing concentration factors. If alpha is set, only a single vector is returned, whereas if nmax is set, the first nmax spectra are returned. Parameters alpha : int, optional, default = None The function number of the output spectrum, where alpha=0 corresponds to the best concentrated Slepian function. nmax : int, optional, default = 1 The number of best concentrated Slepian function power spectra to return. convention : str, optional, default = 'power' The type of spectrum to return: 'power' for power spectrum, 'energy' for energy spectrum, and 'l2norm' for the l2 norm spectrum. unit : str, optional, default = 'per_l' If 'per_l', return the total contribution to the spectrum for each spherical harmonic degree l. If 'per_lm', return the average contribution to the spectrum for each coefficient at spherical harmonic degree l. If 'per_dlogl', return the spectrum per log interval dlog_a(l). base : float, optional, default = 10. The logarithm base when calculating the 'per_dlogl' spectrum. Description This function returns either the power spectrum, energy spectrum, or l2-norm spectrum of one or more of the Slepian funtions. Total power is defined as the integral of the function squared over all space, divided by the area the function spans. If the mean of the function is zero, this is equivalent to the variance of the function. The total energy is the integral of the function squared over all space and is 4pi times the total power. The l2-norm is the sum of the magnitude of the coefficients squared. The output spectrum can be expresed using one of three units. 'per_l' returns the contribution to the total spectrum from all angular orders at degree l. 'per_lm' returns the average contribution to the total spectrum from a single coefficient at degree l. The 'per_lm' spectrum is equal to the 'per_l' spectrum divided by (2l+1). 'per_dlogl' returns the contribution to the total spectrum from all angular orders over an infinitessimal logarithmic degree band. The contrubution in the band dlog_a(l) is spectrum(l, 'per_dlogl')*dlog_a(l), where a is the base, and where spectrum(l, 'per_dlogl) is equal to spectrum(l, 'per_l')*l*log(a). """

        if alpha is None:
            if nmax is None:
                nmax = self.nmax
            spectra = _np.zeros((self.lmax+1, nmax))

            for iwin in range(nmax):
                coeffs = self.to_array(iwin)
                spectra[:, iwin] = _spectrum(coeffs, normalization='4pi',
                                             convention=convention, unit=unit,
                                             base=base)
        else:
            coeffs = self.to_array(alpha)
            spectra = _spectrum(coeffs, normalization='4pi',
                                convention=convention, unit=unit, base=base)

        return spectra