Return an ElementTree Element representing this instance.

        Args:
            include_namespaces (bool, optional): If True, include xml
                namespace attributes on the root element

        Return:
            ~xml.etree.ElementTree.Element: an Element.

def to_element(self, include_namespaces=False):
        """Return an ElementTree Element representing this instance.

        Args:
            include_namespaces (bool, optional): If True, include xml
                namespace attributes on the root element

        Return:
            ~xml.etree.ElementTree.Element: an Element.
        """
        elt_attrib = {}
        if include_namespaces:
            elt_attrib.update({
                'xmlns': "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/",
                'xmlns:dc': "http://purl.org/dc/elements/1.1/",
                'xmlns:upnp': "urn:schemas-upnp-org:metadata-1-0/upnp/",
            })
        elt_attrib.update({
            'parentID': self.parent_id,
            'restricted': 'true' if self.restricted else 'false',
            'id': self.item_id
        })
        elt = XML.Element(self.tag, elt_attrib)

        # Add the title, which should always come first, according to the spec
        XML.SubElement(elt, 'dc:title').text = self.title

        # Add in any resources
        for resource in self.resources:
            elt.append(resource.to_element())

        # Add the rest of the metadata attributes (i.e all those listed in
        # _translation) as sub-elements of the item element.
        for key, value in self._translation.items():
            if hasattr(self, key):
                # Some attributes have a namespace of '', which means they
                # are in the default namespace. We need to handle those
                # carefully
                tag = "%s:%s" % value if value[0] else "%s" % value[1]
                XML.SubElement(elt, tag).text = ("%s" % getattr(self, key))
        # Now add in the item class
        XML.SubElement(elt, 'upnp:class').text = self.item_class

        # And the desc element
        desc_attrib = {'id': 'cdudn', 'nameSpace':
                       'urn:schemas-rinconnetworks-com:metadata-1-0/'}
        desc_elt = XML.SubElement(elt, 'desc', desc_attrib)
        desc_elt.text = self.desc

        return elt