code: def to_dict(self, get_value=None):
          
          result = {}
          for key, value in iteritems(self):
              if isinstance(value, BaseCounter):
                  if get_value is not None:
                      value = getattr(value, get_value)
                  result[key] = value
              else:
                  result[key] = value.to_dict(get_value)
          return result
docs: Dump counters as a dict