simplify dict loops

use .values() instead of .items() when not using the keys
use .keys() directly instead of rebuilding lists from it
Merge pull request #4758 from hulu/simplify-dict-loops

simplify dict loops