class dictionary_iter:
    def __init__(self, dictionary):
        self.dictionary = dictionary
        self.items = list(dictionary.items()) # речникът се обръща на масив от тюпъли
        self.idx = 0 # създаваме допълнителен атрибут индекс
        
        
    def __iter__(self):
        return self
        
    def __next__(self):
        if self.idx >= len(self.items): # условие за пркратяване, ако индекса стане по-голям от дължината на масива!!!
            raise StopIteration
        else:
            result = self.items[self.idx]
            self.idx += 1
            return result