from typing import Dict, TypeVar, Hashable

V = TypeVar('V')
K = TypeVar('K', bound=Hashable)


def renameKeys(obj: Dict[K, V], keyMap: Dict[K, K]) -> Dict[K, V]:
    '''
    creates an object with the same keys as obj and values generated by running each element of object thru iteratee
    >>> renameKeys({'a': 1, 'b': 2, 'c': 3}, {'a': 'b', 'b': 'a'})
    {'b': 1, 'a': 2, 'c': 3}
    '''
    return {keyMap.get(k, k): v for k, v in obj.items()}
