'Extract size, or node type, from a compute node XML representation.
Extract node size, or node type, description from a compute node XML
representation, converting the node size to a NodeSize object.
:type  compute: :class:`ElementTree`
:param compute: XML representation of a compute node.
:rtype:  :class:`OpenNebulaNodeSize`
:return: Node type of compute node.'

def _extract_size(self, compute):

    instance_type = compute.find('INSTANCE_TYPE')
    try:
        return next((node_size for node_size in self.list_sizes() if (node_size.name == instance_type.text)))
    except StopIteration:
        return None
