Fix pyopencv_to for FLANN IndexParams in Python 3.x.

The keys() and values() functions on dictionaries in Python 3 no longer return lists. This caused pyopencv_to() for flann::IndexParams to crash since it tried to access the result of those calls as lists.

It now iterates over the dictionary in a way that is version-agnostic.