Converts the given resource to a string representation and returns
        it.

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