<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def levinson_durbin(acdata, order=None):
 """ Solve the Yule-Walker linear system of equations. They're given by: .. math:: R . a = r where :math:`R` is a simmetric Toeplitz matrix where each element are lags from the given autocorrelation list. :math:`R` and :math:`r` are defined (Python indexing starts with zero and slices don't include the last element):
 .. math:: R[i][j] = acdata[abs(j - i)] r = acdata[1 : order + 1] Parameters acdata : Autocorrelation lag list, commonly the ``acorr`` function output. order : The order of the resulting ZFilter object. Defaults to ``len(acdata) - 1``. Returns ------- A FIR filter, as a ZFilter object. The mean squared error over the given data (variance of the white noise) is in its "error" attribute. See Also -------- acorr: Calculate the autocorrelation of a given block. lpc : Calculate the Linear Predictive Coding (LPC) coefficients. parcor : Partial correlation coefficients (PARCOR), or reflection coefficients, relative to the lattice implementation of a filter, obtained by reversing the Levinson-Durbin algorithm. Examples -------- [12, 6, 0, -3, -6, -3, 0, 2, 4, 2] 1 - 0.625 * z^-1 + 0.25 * z^-2 + 0.125 * z^-3 7.875 Notes ----- The Levinson-Durbin algorithm used to solve the equations needs :math:`O(order^2)` floating point operations. """

  if order is None:
    order = len(acdata) - 1
  elif order >= len(acdata):
    acdata = Stream(acdata).append(0).take(order + 1)

  # Inner product for filters based on above statistics
  def inner(a, b): # Be careful, this depends on acdata !!!
    return sum(acdata[abs(i-j)] * ai * bj
               for i, ai in enumerate(a.numlist)
               for j, bj in enumerate(b.numlist)
              )

  try:
    A = ZFilter(1)
    for m in xrange(1, order + 1):
      B = A(1 / z) * z ** -m
      A -= inner(A, z ** -m) / inner(B, B) * B
  except ZeroDivisionError:
    raise ParCorError("Can't find next PARCOR coefficient")

  A.error = inner(A, A)
  return A