'Pick the best candidate for all image URIs.'

def post_process_images(self, doctree):

    for node in doctree.traverse(nodes.image):
        if ('?' in node['candidates']):
            continue
        if ('*' not in node['candidates']):
            for imgtype in self.supported_image_types:
                candidate = node['candidates'].get(imgtype, None)
                if candidate:
                    break
            else:
                self.warn(('no    matching    candidate    for    image    URI    %r' % node['uri']), ('%s:%s' % (node.source, getattr(node, 'line', ''))))
                continue
            node['uri'] = candidate
        else:
            candidate = node['uri']
        if (candidate not in self.env.images):
            continue
        self.images[candidate] = self.env.images[candidate][1]
