@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+
+class Tag(object):
+    """Tag class"""
+
+    def __init__(self, content=None):
+        self.content = content
+        self.attrs = ' '.join(['%s="%s"' % (attr, value)
+                               for attr, value in self.attrs])
+
+    def __str__(self):
+        return '<%s%s>\n    %s\n</%s>' % (self.name, self.attrs and ' ' + self.attrs or '', self.content, self.name)
+
+
+class ScriptTag(Tag):
+    name = 'script'
+    attrs = (('type', 'text/javascript'),)
+
+
+class AnonymousFunction(object):
+    def __init__(self, arguments, content):
+        self.arguments = arguments
+        self.content = content
+
+    def __str__(self):
+        return 'function(%s) { %s }' % (self.arguments, self.content)
+
+
+class Function(object):
+
+    def __init__(self, name):
+        self.name = name
+        self.statements = []
+
+    def __str__(self):
+        operations = [self.name]
+        operations.extend(str(statement) for statement in self.statements)
+        return '%s' % ('.'.join(operations),)
+
+    def __getattr__(self, attr):
+        self.statements.append(attr)
+        return self
+
+    def __call__(self, args=None):
+        if args is not None and not isinstance(args, basestring):
+            self.statements[-1] = self.statements[-1] + '(%s)' % (args)
+        return self
+
+
+if __name__ == '__main__':
+    nv = Function('nv').addGraph(
+        AnonymousFunction('', Function('nv').models.pieChart(
+            ).x(
+                AnonymousFunction('d', 'return d.label;')
+            ).y(
+                AnonymousFunction('d', 'return d.value;')
+            ).showLabels('true')
+        )
+    )