python iterate over dictionary sorted by value