Allows user to pass in a key function to sort dictionaries and objects in the heap
Added unittests for the new key function