'Lookup an image and return the inspection results.'

def find_image(self, name, tag):

    if (not name):
        return None
    self.log(('Find    image    %s:%s' % (name, tag)))
    images = self._image_lookup(name, tag)
    if (len(images) == 0):
        (registry, repo_name) = auth.resolve_repository_name(name)
        if (registry == 'docker.io'):
            lookup = ('docker.io/%s' % name)
            self.log(('Check    for    docker.io    image:    %s' % lookup))
            images = self._image_lookup(lookup, tag)
    if (len(images) > 1):
        self.fail(('Registry    returned    more    than    one    result    for    %s:%s' % (name, tag)))
    if (len(images) == 1):
        try:
            inspection = self.inspect_image(images[0]['Id'])
        except Exception as exc:
            self.fail(('Error    inspecting    image    %s:%s    -    %s' % (name, tag, str(exc))))
        return inspection
    self.log(('Image    %s:%s    not    found.' % (name, tag)))
    return None
