def METHOD_NAME(quantity_def, section, value, path):
    if quantity_def.unit:
        Q_ = ureg.Quantity
        val_unit = Q_(value, quantity_def.unit)
        default_display_unit = quantity_def.m_annotations.get(
            'eln', {'defaultDisplayUnit': None}
        ).defaultDisplayUnit
        if default_display_unit:
            val_unit = val_unit.to(default_display_unit)
        return dict(
            value=val_unit.magnitude.tolist()
            if isinstance(val_unit.magnitude, np.ndarray)
            else val_unit.magnitude,
            unit=str(format(val_unit.units, '~'))
        )
    return value