def _get_instance_template(self, system_volume, membership, backend_instance_id):
        try:
            image_id = system_volume.volume_image_metadata['image_id']

            return models.Template.objects.get(
                images__backend_id=image_id,
                images__cloud__cloudprojectmembership=membership,
            )
        except (__HOLE__, AttributeError):
            logger.info('Skipping instance %s, failed to infer template',
                        backend_instance_id)
            raise LookupError
        except (models.Template.DoesNotExist, models.Template.MultipleObjectsReturned):
            logger.info('Skipping instance %s, failed to infer template',
                        backend_instance_id)
            raise LookupError
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/iaas/backend.py/OpenStackBackend._get_instance_template