<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def acorr(blk, max_lag=None):
 """ Calculate the autocorrelation of a given 1-D block sequence. Parameters blk : An iterable with well-defined length. Don't use this function with Stream objects! max_lag : The size of the result, the lags you'd need. Defaults to ``len(blk) - 1``, since any lag beyond would result in zero. Returns ------- A list with lags from 0 up to max_lag, where its ``i``-th element has the autocorrelation for a lag equals to ``i``. Be careful with negative lags! You should use abs(lag) indexes when working with them. Examples -------- [59, 52, 42, 30, 17, 8, 2] [59, 52, 42, 30, 17, 8, 2, 0, 0, 0] 4 [59, 52, 42, 30] """

  if max_lag is None:
    max_lag = len(blk) - 1
  return [sum(blk[n] * blk[n + tau] for n in xrange(len(blk) - tau))
          for tau in xrange(max_lag + 1)]