returns an iterator for traversing the keys in the map def __iter__self )finds the slot containing the key or where the key can be added forinsert indicates if the search is for an insertionwhich locates the slot into which the new key can be added def _findslotselfkeyforinsert )compute the home slot and the step size slot self _hash key step self _hash key probe for the key len(self _tablewhile self _table[slotis not unused if forinsert and (self _table[slotis unused or self _table[slotis emptyreturn slot elif not forinsert and (self _table[slotis not empty and self _table[slotkey =keyreturn slot else slot (slot stepm rebuilds the hash table def _rehashself create new larger table origtable self _table newsize len(self _table self _table arraynewsize modify the size attributes self _count self _maxcount newsize newsize / add the keys from the original array to the new table for entry in origtable if entry is not unused and entry is not empty slot self _findslotkeytrue self _table[slotentry self _count + the main hash function for mapping keys to table entries def _hash selfkey )return abshash(keylen(self _tablethe second hash function used with double hashing probes def _hash selfkey )return abshash(key(len(self _table storage class for holding the key/value pairs class _mapentry def __init__selfkeyvalue )self key key self value value