def get_clean_quantity(self, quantity=1):
        """
        Returns the correct formatted quantity based on the product's type of
        quantity field.
        """
        try:
            quantity = abs(core_utils.atof(str(quantity)))
        except (__HOLE__, ValueError):
            quantity = 1.0

        type_of_quantity_field = self.get_type_of_quantity_field()
        if type_of_quantity_field == QUANTITY_FIELD_INTEGER:
            quantity = int(quantity)
        elif type_of_quantity_field == QUANTITY_FIELD_DECIMAL_1:
            quantity = locale.format("%.1f", quantity)
        else:
            quantity = locale.format("%.2f", quantity)

        return quantity
dataset/ETHPy150Open diefenbach/django-lfs/lfs/catalog/models.py/Product.get_clean_quantity