'Use the key information to decode the data XML if present.'

def decode_data_elements(self, graphml_keys, obj_xml):

    data = {}
    for data_element in obj_xml.findall(('{%s}data' % self.NS_GRAPHML)):
        key = data_element.get('key')
        try:
            data_name = graphml_keys[key]['name']
            data_type = graphml_keys[key]['type']
        except KeyError:
            raise nx.NetworkXError(('Bad    GraphML    data:    no    key    %s' % key))
        text = data_element.text
        if ((text is not None) and (len(list(data_element)) == 0)):
            if (data_type == bool):
                data[data_name] = self.convert_bool[text.lower()]
            else:
                data[data_name] = data_type(text)
        elif (len(list(data_element)) > 0):
            node_label = None
            for node_type in ['ShapeNode', 'SVGNode', 'ImageNode']:
                pref = ('{%s}%s/{%s}' % (self.NS_Y, node_type, self.NS_Y))
                geometry = data_element.find(('%sGeometry' % pref))
                if (geometry is not None):
                    data['x'] = geometry.get('x')
                    data['y'] = geometry.get('y')
                if (node_label is None):
                    node_label = data_element.find(('%sNodeLabel' % pref))
            if (node_label is not None):
                data['label'] = node_label.text
            for e in ['PolyLineEdge', 'SplineEdge', 'QuadCurveEdge', 'BezierEdge', 'ArcEdge']:
                pref = ('{%s}%s/{%s}' % (self.NS_Y, e, self.NS_Y))
                edge_label = data_element.find(('%sEdgeLabel' % pref))
                if (edge_label is not None):
                    break
            if (edge_label is not None):
                data['label'] = edge_label.text
    return data
