docs: def normal_var(data, mean):
      """ Creates a segment cost function for a time series with a
          Normal distribution with changing variance
  
      Args:
          data (:obj:`list` of float): 1D time series data
          variance (float): variance
      Returns:
          function: Function with signature
              (int, int) -> float
              where the first arg is the starting index, and the second
              is the last arg. Returns the cost of that segment
      """
      if not isinstance(data, np.ndarray):
          data = np.array(data)
  
      cumm = [0.0]
      cumm.extend(np.cumsum(np.power(np.abs(data - mean), 2)))
  
      def cost(s, t):
          """ Cost function for normal distribution with variable variance
  
          Args:
              start (int): start index
              end (int): end index
          Returns:
              float: Cost, from start to end
          """
          dist = float(t - s)
          diff = cumm[t] - cumm[s]
          return dist * np.log(diff/dist)
  
      return cost