def clean(self, value):
        if isinstance(value, decimal.Decimal):
            # Value is already an integer.
            return value

        if isinstance(value, six.string_types):
            # Strip the string of whitespace
            value = value.strip()

        if not value:
            # Value is nothing; return nothing.
            return None

        try:
            # Attempt to coerce whatever we have as an int.
            return decimal.Decimal(value)

        except (__HOLE__, decimal.InvalidOperation):
            # Failed to do so.
            raise ValueError('Not a valid decimal value.')
dataset/ETHPy150Open armet/python-armet/armet/attributes/decimal.py/DecimalAttribute.clean