'Gets a non-deprecated image from a project with a given prefix.
The images provided by gce go in distribution-specific projects, but
are publicly accessible by anyone.
For example, all ubuntu images are in the ``ubuntu-os-cloud`` project.
In that project there is only 1 non-deprecated image for the various
ubuntu versions (1 for ubuntu 14.04, 1 for ubuntu 15.10, etc). There
are also many deprecated versions, which were marked as deprecated when
the new one was created (for security updates, etc.). All of the 14.04
images are named ubuntu-1404-trusty-vYYYYMMDD?. So, searching the
``ubuntu-os-cloud`` project for a non-deprecated image with the
``ubuntu-1404`` prefix is a reasonable way to find the latest ubuntu
14.04 image.
The best way to get a list of possible ``image_name_prefix`` values is
to look at the output from ``gcloud compute images list``
If you don\'t have the gcloud executable installed, it can be pip
installed: ``pip install gcloud``
project, image_name_prefix examples:
* ubuntu-os-cloud, ubuntu-1404
* centos-cloud, centos-7
:param compute: The Google Compute Engine Service object used to make
calls to the GCE API.
:returns: The image resource dict representing the GCE image resource,
or None if no image found.'

def get_active_image(self, compute):

    latest_image = None
    page_token = None
    while (not latest_image):
        response = compute.images().list(project=self.project, maxResults=500, pageToken=page_token, filter='name    eq    {}.*'.format(self.image_name_prefix)).execute()
        latest_image = next((image for image in response.get('items', []) if ('deprecated' not in image)), None)
        page_token = response.get('nextPageToken')
        if (not page_token):
            break
    return latest_image
