          # Here we ensure that all the values are *lists* of errors.
          return dict([
              (key, value if isinstance(value, list) else [value])
              for key, value in exc.detail.items()
          ])
      elif isinstance(exc.detail, list):
          # Errors raised as a list are non-field errors.
          return {
              api_settings.NON_FIELD_ERRORS_KEY: exc.detail
          }
 
</s> remove         return dict([
            (key, value if isinstance(value, list) else [value])
 </s> add         return {
            key: value if isinstance(value, list) else [value] </s> remove         unique_constraint_names -= set([None])
 </s> add         unique_constraint_names -= {None} </s> remove         ])
 </s> add         } </s> remove             unique_constraint_names |= set([
                model_field.unique_for_date,
                model_field.unique_for_month,
                model_field.unique_for_year
            ])
 </s> add             unique_constraint_names |= {model_field.unique_for_date, model_field.unique_for_month,
                                        model_field.unique_for_year} </s> remove         ret = dict([
            (key, _force_text_recursive(value))
 </s> add         ret = {
            key: _force_text_recursive(value)
        }
          # Here we ensure that all the values are *lists* of errors.
          return dict([
              (key, value if isinstance(value, list) else [value])
              for key, value in exc.detail.items()
        }
      elif isinstance(exc.detail, list):
          # Errors raised as a list are non-field errors.
          return {
              api_settings.NON_FIELD_ERRORS_KEY: exc.detail
          }
keep keep keep keep replace keep keep keep keep keep
 Replaced all dict and set conversions from lists to dict and set literals. 
rest_framework/serializers.py