def _maybe_make_unit_desc(self, unit_desc):
    """Return the UnitDescriptor or convert a string to one."""
    if isinstance(unit_desc, str) or unit_desc is None:
      unit_desc = units.Unit(unit_desc)
    if not isinstance(unit_desc, units.UnitDescriptor):
      raise TypeError('Invalid units for measurement %s: %s' % (self.name,
                                                                unit_desc))
    return unit_desc
Return the UnitDescriptor or convert a string to one.