'Opens a new element.  Attributes can be given as keyword
arguments, or as a string/string dictionary.  The method
returns an opaque identifier that can be passed to the
:meth:`close` method, to close all open elements up to and
including this one.
Parameters
tag : str
The element name
attrib : dict of str -> str
Attribute dictionary.  Alternatively, attributes can
be given as keyword arguments.
Returns
id : int
Returns an element identifier.'

def start(self, tag, attrib={}, **extra):

    self._flush()
    self._data = []
    self._tags.append(tag)
    self.write(self.get_indentation_spaces((-1)))
    self.write(u'<{}'.format(tag))
    if (attrib or extra):
        attrib = attrib.copy()
        attrib.update(extra)
        attrib = list(six.iteritems(attrib))
        attrib.sort()
        for (k, v) in attrib:
            if (v is not None):
                v = self.xml_escape(v)
                self.write(u'    {}="{}"'.format(k, v))
    self._open = 1
    return len(self._tags)
