code: def _render_image(self, spec, container_args, alt_text=None):
          
  
          try:
              path, image_args, title = image.parse_image_spec(spec)
          except Exception as err:  # pylint: disable=broad-except
              logger.exception("Got error on spec %s: %s", spec, err)
              return ('<span class="error">Couldn\'t parse image spec: ' +
                      '<code>{}</code> {}</span>'.format(flask.escape(spec),
                                                         flask.escape(str(err))))
  
          composite_args = {**container_args, **image_args}
  
          try:
              img = image.get_image(path, self._search_path)
          except Exception as err:  # pylint: disable=broad-except
              logger.exception("Got error on image %s: %s", path, err)
              return ('<span class="error">Error loading image {}: {}</span>'.format(
                  flask.escape(spec), flask.escape(str(err))))
  
          return img.get_img_tag(title, alt_text, **composite_args)
docs: Render an image specification into an <img> tag