Fix ImmutableMultiDict handling for python 3.7
For some reason, in python 3.7 `dict()`-call over ImmutableMultiDict
structure from Werkzeug behaves differently. In the previous versions a
dict of lists is created (thus representing all the values given to the
specific URL-encoded query parameter), py37 only creates a dict
containing the first value in string form.
This patch makes sure the ImmutableMultiDict is converted to a
dict-of-lists in a foolproof fashion.