<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def summary(self, alpha=0.05, start=0, batches=100, chain=None, roundto=3):
 """ Generate a pretty-printed summary of the node. :Parameters: alpha : float The alpha level for generating posterior intervals. Defaults to 0.05. start : int The starting index from which to summarize (each) chain. Defaults to zero. batches : int Batch size for calculating standard deviation for non-independent samples. Defaults to 100. chain : int The index for which chain to summarize. Defaults to None (all chains). roundto : int The number of digits to round posterior statistics. """


        # Calculate statistics for Node
        statdict = self.stats(
            alpha=alpha,
            start=start,
            batches=batches,
            chain=chain)
        
        size = np.size(statdict['mean'])

        print_('\n%s:' % self.__name__)
        print_(' ')

        # Initialize buffer
        buffer = []

        # Index to interval label
        iindex = [key.split()[-1] for key in statdict.keys()].index('interval')
        interval = list(statdict.keys())[iindex]

        # Print basic stats
        buffer += [
            'Mean             SD               MC Error        %s' %
            interval]
        buffer += ['-' * len(buffer[-1])]

        indices = range(size)
        if len(indices) == 1:
            indices = [None]
        
        _format_str = lambda x, i=None, roundto=2: str(np.round(x.ravel()[i].squeeze(), roundto))
            
        for index in indices:
            # Extract statistics and convert to string
            m = _format_str(statdict['mean'], index, roundto)
            sd = _format_str(statdict['standard deviation'], index, roundto)
            mce = _format_str(statdict['mc error'], index, roundto)
            hpd = str(statdict[interval].reshape(
                    (2, size))[:,index].squeeze().round(roundto))

            # Build up string buffer of values
            valstr = m
            valstr += ' ' * (17 - len(m)) + sd
            valstr += ' ' * (17 - len(sd)) + mce
            valstr += ' ' * (len(buffer[-1]) - len(valstr) - len(hpd)) + hpd

            buffer += [valstr]

        buffer += [''] * 2

        # Print quantiles
        buffer += ['Posterior quantiles:', '']

        buffer += [
            '2.5             25              50              75             97.5']
        buffer += [
            ' |---------------|===============|===============|---------------|']

        for index in indices:
            quantile_str = ''
            for i, q in enumerate((2.5, 25, 50, 75, 97.5)):
                qstr = _format_str(statdict['quantiles'][q], index, roundto)
                quantile_str += qstr + ' ' * (17 - i - len(qstr))
            buffer += [quantile_str.strip()]

        buffer += ['']

        print_('\t' + '\n\t'.join(buffer))