<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def convert(self, targetunits):
 """Set new user unit, for either wavelength or flux. This effectively converts the spectrum wavelength or flux to given unit. Note that actual data are always kept in internal units (Angstrom and ``photlam``), and only converted to user units by :meth:`getArrays` during actual computation. User units are stored in ``self.waveunits`` and ``self.fluxunits``. Parameters targetunits : str New unit name, as accepted by `~pysynphot.units.Units`. """

        nunits = units.Units(targetunits)

        if nunits.isFlux:
            self.fluxunits = nunits
        else:
            self.waveunits = nunits