def get_instance(self, instance_class=None, fields=[]):
        """
        Returns an instance (dict) of this xml element. The instance
        holds a reference to this xml element.   
        """
        if not instance_class:
            instance_class = Element
        if not fields and hasattr(instance_class, 'fields'):
            fields = instance_class.fields

        if not fields:
            instance = instance_class(self.attrib, self)
        else:
            instance = instance_class({}, self)
            for field in fields:
                if field in self.attrib:
                   instance[field] = self.attrib[field]  
        return instance
dataset/ETHPy150Open fp7-ofelia/ocf/ofam/src/src/foam/sfa/util/xml.py/XmlElement.get_instance/original