<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_valid_units(self, ureg, from_unit, target_unit):
 """ Returns the firt match `pint.unit.Unit` object for from_unit and target_unit strings from a possible variation of metric unit names supported by pint library. :param ureg: unit registry which units are defined and handled :type ureg: `pint.registry.UnitRegistry` :param from_unit: source metric unit :type from_unit: str :param from_unit: target metric unit :type from_unit: str """

        from_unit_variations = [from_unit.lower(), from_unit.upper()]
        target_unit_variations = [target_unit.lower(), target_unit.upper()]
        from_unit = self.get_unit(ureg, from_unit_variations)
        target_unit = self.get_unit(ureg, target_unit_variations)
        return from_unit, target_unit