Just to make the code a little clearer, I would move all of this validation for the dict case under the ``if isinstance(values, dict)``.  Plus, then you don't have to create an empty ``dict_values`` for every case.