code: def _linear_interp(curve, test_x, round_result=False):
      index = 0
      for index in range(len(curve) - 1):
          if curve[index][0] == curve[index + 1][0]:
              continue
          if curve[index][0] <= test_x <= curve[index + 1][0]:
              slope = ((curve[index + 1][1] - curve[index][1]) /
                       (curve[index + 1][0] - curve[index][0]))
              y_intercept = curve[index][1] - (slope * curve[index][0])
              result = (slope * test_x) + y_intercept
              if round_result:
                  return int(round(result))
              else:
                  if result.is_integer():
                      return int(result)
                  else:
                      return result
      else:
          raise ProbabilityUndefinedError