python iterate dictionary sorted by key