              return value
          elif hasattr(value, '__iter__') and not isinstance(value, (dict, six.string_types)):
              return [self.to_native(item) for item in value]
          elif isinstance(value, dict):
              return dict(map(self.to_native, (k, v)) for k, v in value.items())
          return smart_text(value)
  
      def attributes(self):
          """
          Returns a dictionary of attributes to be used when serializing to xml.
 
</s>
            # Make sure we preserve field ordering, if it exists
            ret = SortedDict()
            for key, val in value.items():
                ret[key] = self.to_native(val)
            return ret
              return value
          elif hasattr(value, '__iter__') and not isinstance(value, (dict, six.string_types)):
              return [self.to_native(item) for item in value]
          elif isinstance(value, dict):
            # Make sure we preserve field ordering, if it exists
            ret = SortedDict()
            for key, val in value.items():
                ret[key] = self.to_native(val)
            return ret
          return smart_text(value)
  
      def attributes(self):
          """
          Returns a dictionary of attributes to be used when serializing to xml.
keep keep keep keep replace keep keep keep keep keep
 serializers.Field respects ordering on dicts if it exists.  Closes #832
rest_framework/fields.py