<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _check_unit(new_unit, old_unit):
 """ Check that the new unit is compatible with the old unit for the quantity described by variable_name :param new_unit: instance of astropy.units.Unit :param old_unit: instance of astropy.units.Unit :return: nothin """


    try:

        new_unit.physical_type

    except AttributeError:

        raise UnitMismatch("The provided unit (%s) has no physical type. Was expecting a unit for %s"
                           % (new_unit, old_unit.physical_type))

    if new_unit.physical_type != old_unit.physical_type:

        raise UnitMismatch("Physical type mismatch: you provided a unit for %s instead of a unit for %s"
                           % (new_unit.physical_type, old_unit.physical_type))