def METHOD_NAME(self):
    fmtstr = ''
    if self.summary_type is Summary.NONE:
        fmtstr = ''
    elif self.summary_type is Summary.AVERAGE:
        fmtstr = '{name} {avg:.3f}'
    elif self.summary_type is Summary.SUM:
        fmtstr = '{name} {sum:.3f}'
    elif self.summary_type is Summary.COUNT:
        fmtstr = '{name} {count:.3f}'
    else:
        raise ValueError('invalid summary type %r' % self.summary_type)
    return fmtstr.format(**self.__dict__)