class hashtabledef __init__(self)self size self slots [noneself size self data [noneself size hash_function implements the simple remainder method the collision resolution technique is linear probing with "plus rehash function the put function (see listing assumes that there will eventually be an empty slot unless the key is already present in the self slots it computes the original hash value and if that slot is not emptyiterates the rehash function until an empty slot occurs if nonempty slot already contains the keythe old data value is replaced with the new data value listing functions to place items in the hash table def put(selfkeydata)hash_value self hash_function(key,len(self slots) if self slots[hash_value=noneself slots[hash_valuekey self data[hash_valuedata elseif self slots[hash_value=keyself data[hash_valuedata #replace elsenext_slot self rehash(hash_valuelen(self slots)while self slots[next_slot!none and self slots[next_slot!keynext_slot self rehash(next_slotlen(self slots) if self slots[next_slot=noneself slots[next_slotkey self data[next_slotdata elseself data[next_slotdata #replace def hash_function(selfkeysize)return key size def rehash(selfold_hashsize)return (old_hash size likewisethe get function begins by computing the initial hash value if the value is not in the initial slotrehash is used to locate the next possible position notice that line guarantees that the search will terminate by checking to make sure that we have not returned to the initial slot if that happenswe have exhausted all possible slots and the item must not be present the final methods of the hashtable class provide additional dictionary functionality we overload the __getitem__ and __setitem__ methods to allow access using "[this means that once hashtable has been createdthe familiar index operator will be available searching