'Returns a new `NDData` object whose values have been converted
to a new unit.
Parameters
unit : `astropy.units.UnitBase` instance or str
The unit to convert to.
equivalencies : list of equivalence pairs, optional
A list of equivalence pairs to try if the units are not
directly convertible.  See :ref:`unit_equivalencies`.
Returns
result : `~astropy.nddata.NDData`
The resulting dataset
Raises
UnitsError
If units are inconsistent.'

def convert_unit_to(self, unit, equivalencies=[]):

    if (self.unit is None):
        raise ValueError(u'No    unit    specified    on    source    data')
    data = self.unit.to(unit, self.data, equivalencies=equivalencies)
    if (self.uncertainty is not None):
        uncertainty_values = self.unit.to(unit, self.uncertainty.array, equivalencies=equivalencies)
        uncertainty = self.uncertainty.__class__(uncertainty_values)
    else:
        uncertainty = None
    if (self.mask is not None):
        new_mask = self.mask.copy()
    else:
        new_mask = None
    result = self.__class__(data, uncertainty=uncertainty, mask=new_mask, wcs=self.wcs, meta=self.meta, unit=unit)
    return result
