docs: def poisson(data):
      """ Creates a segment cost function for a time series with a
          poisson distribution with changing mean
  
      Args:
          data (:obj:`list` of float): 1D time series data
      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
      """
      data = np.hstack(([0.0], np.array(data)))
      cumm = np.cumsum(data)
  
      def cost(s, t):
          """ Cost function for poisson distribution with changing mean
  
          Args:
              start (int): start index
              end (int): end index
          Returns:
              float: Cost, from start to end
          """
          diff = cumm[t]-cumm[s]
          if diff == 0:
              return -2 * diff * (- np.log(t-s) - 1)
          else:
              return -2 * diff * (np.log(diff) - np.log(t-s) - 1)
  
      return cost