separate chaining code fragment provides concrete implementation of hash table with separate chainingin the form of the chainhashmap class to represent single bucketit relies on an instance of the unsortedtablemap class from code fragment the first three methods in the class use index to access the potential bucket in the bucket arrayand check for the special case in which that table entry is none the only time we need new bucket structure is when bucket setitem is called on an otherwise empty slot the remaining functionality relies on map behaviors that are already supported by the individual unsortedtablemap instances we need bit of forethought to determine whether the application of setitem on the chain causes net increase in the size of the map (that iswhether the given key is new class chainhashmap(hashmapbase) """hash map implemented with separate chaining for collision resolution "" def bucket getitem(selfjk) bucket self table[ if bucket is noneno match found raise keyerrorkey errorrepr( ) return bucket[kmay raise keyerror def bucket setitem(selfjkv) if self table[jis nonebucket is new to the table self table[junsortedtablemap oldsize len(self table[ ] self table[ ][kv key was new to the table if len(self table[ ]oldsizeincrease overall map size self + def bucket delitem(selfjk) bucket self table[ if bucket is noneno match found raise keyerrorkey errorrepr( ) del bucket[kmay raise keyerror def iter (self) for bucket in self table if bucket is not nonea nonempty slot for key in bucket yield key code fragment concrete hash map class with separate chaining