docs: def iteritems(self, key_type=None, return_all_keys=False):
          """ Returns an iterator over the dictionary's (key, value) pairs.
              @param key_type if specified, iterator will be returning only (key,value) pairs for this type of key.
                     Otherwise (if not specified) ((keys,...), value) 
                     i.e. (tuple of keys, values) pairs for all items in this dictionary will be generated.
              @param return_all_keys if set to True - tuple of keys is retuned instead of a key of this type."""
  
          if key_type is None:
              for item in self.items_dict.items():
                  yield item
              return
          used_keys = set()
          key = str(key_type)
          if key in self.__dict__:
              for key, keys in self.__dict__[key].items():
                  if keys in used_keys:
                      continue
                  used_keys.add(keys)
                  value = self.items_dict[keys]
                  if not return_all_keys:
                      keys = tuple(k for k in keys if isinstance(k, key_type))
                  yield keys, value