Rename flatten funciton.

flatten(x) is used a lot in the various lookup plugins where in each it is slightly different. This is to make this name slightly more unique.
Merge pull request #6166 from risaacson/rename_flatten_in_dict

Rename flatten function.