diff --git a/django/utils/html.py b/django/utils/html.py
index 951b3f2..8d8d673 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -38,8 +38,8 @@ def conditional_escape(html):
     """
     Similar to escape(), except that it doesn't operate on pre-escaped strings.
     """
-    if isinstance(html, SafeData):
-        return html
+    if hasattr(html, '__html__'):
+        return html.__html__()
     else:
         return escape(html)
 
diff --git a/django/utils/safestring.py b/django/utils/safestring.py
index 2e31c23..6f7a22a 100644
--- a/django/utils/safestring.py
+++ b/django/utils/safestring.py
@@ -22,7 +22,14 @@ class EscapeUnicode(unicode, EscapeData):
     pass
 
 class SafeData(object):
-    pass
+
+    def __html__(self):
+        """
+        Returns the html representation of a string.
+
+        Allows interoperability with other template engines.
+        """
+        return self
 
 class SafeString(str, SafeData):
     """
diff --git a/tests/regressiontests/utils/tests.py b/tests/regressiontests/utils/tests.py
index 4ad4e63..01b712d 100644
--- a/tests/regressiontests/utils/tests.py
+++ b/tests/regressiontests/utils/tests.py
@@ -4,7 +4,7 @@ Tests for django.utils.
 
 from unittest import TestCase
 
-from django.utils import html, checksums, text
+from django.utils import html, checksums, text, safestring
 from django.utils.functional import SimpleLazyObject
 
 import timesince
@@ -144,6 +144,12 @@ class TestUtilsHtml(TestCase):
         for value, output in items:
             self.check_output(f, value, output)
 
+    def test_conditional_escape(self):
+        s = '<h1>interop</h1>'
+        self.assertEqual(html.conditional_escape(s),
+                         '&lt;h1&gt;interop&lt;/h1&gt;')
+        self.assertEqual(html.conditional_escape(safestring.mark_safe(s)), s)
+
 class TestUtilsChecksums(TestCase):
 
     def check_output(self, function, value, output=None):
@@ -262,6 +268,12 @@ class TestUtilsText(TestCase):
         self.assertEqual(u'<p><strong><em>The quick brown fox</em></strong></p>',
             text.truncate_html_words('<p><strong><em>The quick brown fox jumped over the lazy dog.</em></strong></p>', 4, None))
 
+class TestSafeData(TestCase):
+
+    def test_html(self):
+        s = '<h1>interop</h1>'
+        self.assertEqual(s, safestring.mark_safe(s).__html__())
+
 if __name__ == "__main__":
     import doctest
     doctest.testmod()
