fixed one bug with blocks, one to go

--HG--
branch : trunk
diff --git a/jinja2/utils.py b/jinja2/utils.py
index 3f6395e..23a3b15 100644
--- a/jinja2/utils.py
+++ b/jinja2/utils.py
@@ -8,3 +8,16 @@
     :copyright: 2008 by Armin Ronacher.
     :license: BSD, see LICENSE for more details.
 """
+
+
+def escape(obj, attribute=False):
+    """HTML escape an object."""
+    if hasattr(obj, '__html__'):
+        return obj.__html__()
+    s = unicode(obj) \
+        .replace('&', '&') \
+        .replace('>', '>') \
+        .replace('<', '&lt;')
+    if attribute:
+        s = s.replace('"', '&quot;')
+    return s