<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def finalize(self):
 """Output the aggregate block count results."""

        for name, count in sorted(self.blocks.items(), key=lambda x: x[1]):
            print('{:3} {}'.format(count, name))
        print('{:3} total'.format(sum(self.blocks.values())))