for k, v in k_map: ValueError: too many values to unpack (expected 2)

Cause of error:

You can’t traverse the key value pairs of the dictionary like this in Python

for k, v in k_map: 

It needs to be written

for k, v in k_map.items(): 

Read More: