code: def compute(self, base, precision=None):
          '''
          Computes the amount of the treatment.
          @param base:float Gross
          @return: Decimal
          '''
          if base <= ZERO:
              return ZERO
  
          if self.rate_type == RATE_TYPE_FIXED:
              if not self.interval or base >= self.interval.lower:
                  return quantize(self.rate, precision)
              return ZERO
  
          if not self.interval:
              return quantize(base * self.rate / 100, precision)
  
          if base > self.interval.lower:
              base = min(base, self.interval.upper) - self.interval.lower
              return quantize(base * self.rate / 100, precision)
  
          return ZERf compute(self, base, precision=None):
          '''
          Computes the amount of the treatment.
          @param base:float Gross
          @return: Decimal
          '''
          if base <= ZERO:
              return ZERO
  
          if self.rate_type == RATE_TYPE_FIXED:
              if not self.interval or base >= self.interval.lower:
                  return quantize(self.rate, precision)
              return ZERO
  
          if not self.interval:
              return quantize(base * self.rate / 100, precision)
  
          if base > self.interval.lower:
              base = min(base, self.interval.upper) - self.interval.lower
              return quantize(base * self.rate / 100, precision)
  
          return ZERO
docs: Computes the amount of the treatment.
          @param base:float Gross
          @return: Decimal