code: def acorr(blk, max_lag=None):
    
    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)]
docs: 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
    --------
    >>> seq = [1, 2, 3, 4, 3, 4, 2]
    >>> acorr(seq) # Default max_lag is len(seq) - 1
    [59, 52, 42, 30, 17, 8, 2]
    >>> acorr(seq, 9) # Zeros at the end
    [59, 52, 42, 30, 17, 8, 2, 0, 0, 0]
    >>> len(acorr(seq, 3)) # Resulting length is max_lag + 1
    4
    >>> acorr(seq, 3)
    [59, 52, 42, 30]