'Do a comparison between self and other, raising UnitsError when
other cannot be converted to self because it has different physical
unit, and returning NotImplemented when there are other errors.'

def _comparison(self, other, comparison_func):

    try:
        other_in_own_unit = self._to_own_unit(other, check_precision=False)
    except UnitsError as exc:
        if (self.unit.physical_unit != dimensionless_unscaled):
            raise exc
        try:
            other_in_own_unit = self._function_view._to_own_unit(other, check_precision=False)
        except Exception:
            raise exc
    except Exception:
        return NotImplemented
    return comparison_func(other_in_own_unit)
