'Create new dataform of type \'typ\'; \'data\' is the list of DataReported,
DataItem and DataField instances that this dataform contains; \'title\'
is the title string.
You can specify the \'node\' argument as the other node to be used as
base for constructing this dataform.
title and instructions is optional and SHOULD NOT contain newlines.
Several instructions MAY be present.
\'typ\' can be one of (\'form\' | \'submit\' | \'cancel\' | \'result\' )
\'typ\' of reply iq can be ( \'result\' | \'set\' | \'set\' | \'result\' ) respectively.
\'cancel\' form can not contain any fields. All other forms contains AT LEAST one field.
\'title\' MAY be included in forms of type "form" and "result"'

def __init__(self, typ=None, data=[], title=None, node=None):

    Node.__init__(self, 'x', node=node)
    if node:
        newkids = []
        for n in self.getChildren():
            if (n.getName() == 'field'):
                newkids.append(DataField(node=n))
            elif (n.getName() == 'item'):
                newkids.append(DataItem(node=n))
            elif (n.getName() == 'reported'):
                newkids.append(DataReported(node=n))
            else:
                newkids.append(n)
        self.kids = newkids
    if typ:
        self.setType(typ)
    self.setNamespace(NS_DATA)
    if title:
        self.setTitle(title)
    if (type(data) == type({})):
        newdata = []
        for name in data.keys():
            newdata.append(DataField(name, data[name]))
        data = newdata
    for child in data:
        if (type(child) in [type(''), type(u'')]):
            self.addInstructions(child)
        elif (child.__class__.__name__ == 'DataField'):
            self.kids.append(child)
        elif (child.__class__.__name__ == 'DataItem'):
            self.kids.append(child)
        elif (child.__class__.__name__ == 'DataReported'):
            self.kids.append(child)
        else:
            self.kids.append(DataField(node=child))
