

def _to_image(self, element, locations=None):
    location_id = element.get('datacenterId')
    if (locations is None):
        locations = self.list_locations(location_id)
    location = list(filter((lambda x: (x.id == location_id)), locations))[0]
    cpu_spec = self._to_cpu_spec(element.find(fixxpath('cpu', TYPES_URN)))
    os_el = element.find(fixxpath('operatingSystem', TYPES_URN))
    if element.tag.endswith('customerImage'):
        is_customer_image = True
    else:
        is_customer_image = False
    extra = {
        'description': findtext(element, 'description', TYPES_URN),
        'OS_type': os_el.get('family'),
        'OS_displayName': os_el.get('displayName'),
        'cpu': cpu_spec,
        'memoryGb': findtext(element, 'memoryGb', TYPES_URN),
        'osImageKey': findtext(element, 'osImageKey', TYPES_URN),
        'created': findtext(element, 'createTime', TYPES_URN),
        'location': location,
        'isCustomerImage': is_customer_image,
    }
    return NodeImage(id=element.get('id'), name=str(findtext(element, 'name', TYPES_URN)), extra=extra, driver=self.connection.driver)

dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/dimensiondata.py DimensionDataNodeDriver._to_image/original