'Display info about playbook statistics'

def playbook_on_stats(self, stats):

    hosts = sorted(stats.processed.keys())
    t = prettytable.PrettyTable(['Host', 'Ok', 'Changed', 'Unreachable', 'Failures'])
    failures = False
    unreachable = False
    for h in hosts:
        s = stats.summarize(h)
        if (s['failures'] > 0):
            failures = True
        if (s['unreachable'] > 0):
            unreachable = True
        t.add_row(([h] + [s[k] for k in ['ok', 'changed', 'unreachable', 'failures']]))
    self.send_msg(('%s:    Playbook    complete' % self.playbook_name), notify=True)
    if (failures or unreachable):
        color = 'red'
        self.send_msg(('%s:    Failures    detected' % self.playbook_name), color=color, notify=True)
    else:
        color = 'green'
    self.send_msg(('/code    %s:\n%s' % (self.playbook_name, t)), color=color)
