code: def to_string(self, obj):
          
          stream = NativeIO()
          self.to_stream(obj, stream)
          return text_(stream.getvalue(), encoding=self.encoding)
docs: Converts the given resource to a string representation and returns
          it.