docs: def calcDeviationLimits(value, tolerance, mode):
      """Returns the upper and lower deviation limits for a value and a given
      tolerance, either as relative or a absolute difference.
  
      :param value: can be a single value or a list of values if a list of values
          is given, the minimal value will be used to calculate the lower limit
          and the maximum value to calculate the upper limit
      :param tolerance: a number used to calculate the limits
      :param mode: either ``absolute`` or ``relative``, specifies how the
          ``tolerance`` should be applied to the ``value``.
      """
      values = toList(value)
      if mode == 'relative':
          lowerLimit = min(values) * (1 - tolerance)
          upperLimit = max(values) * (1 + tolerance)
      elif mode == 'absolute':
          lowerLimit = min(values) - tolerance
          upperLimit = max(values) + tolerance
      else:
          raise Exception('mode %s not specified' %(filepath, ))
      return lowerLimit, upperLimit