'Update stats history.'

def update_stats_history(self):

    if (self.get_key() is None):
        item_name = ''
    else:
        item_name = self.get_key()
    if (self.stats and self._history_enable()):
        for i in self.get_items_history_list():
            if isinstance(self.stats, list):
                for l in self.stats:
                    self.stats_history.add(((l[item_name] + '_') + i['name']), l[i['name']], description=i['description'], history_max_size=self._limits['history_size'])
            else:
                self.stats_history.add(i['name'], self.stats[i['name']], description=i['description'], history_max_size=self._limits['history_size'])
