code: def dimension_range(lower, upper, hard_range, soft_range, padding=None, log=False):
      
      lower, upper = range_pad(lower, upper, padding, log)
      lower = max_range([(lower, None), (soft_range[0], None)])[0]
      upper = max_range([(None, upper), (None, soft_range[1])])[1]
      dmin, dmax = hard_range
      lower = lower if dmin is None or not isfinite(dmin) else dmin
      upper = upper if dmax is None or not isfinite(dmax) else dmax
      return lower, upper
docs: Computes the range along a dimension by combining the data range
      with the Dimension soft_range and range.