code: def _resolve_image(ret, image, client_timeout):
      '''
      Resolve the image ID and pull the image if necessary
      '''
      image_id = __salt__['docker.resolve_image_id'](image)
  
      if image_id is False:
          if not __opts__['test']:
              # Image not pulled locally, so try pulling it
              try:
                  pull_result = __salt__['docker.pull'](
                      image,
                      client_timeout=client_timeout,
                  )
              except Exception as exc:
                  raise CommandExecutionError(
                      'Failed to pull {0}: {1}'.format(image, exc)
                  )
              else:
                  ret['changes']['image'] = pull_result
                  # Try resolving again now that we've pulled
                  image_id = __salt__['docker.resolve_image_id'](image)
                  if image_id is False:
                      # Shouldn't happen unless the pull failed
                      raise CommandExecutionError(
                          'Image \'{0}\' not present despite a docker pull '
                          'raising no errors'.format(image)
                      )
      return image_if _resolve_image(ret, image, client_timeout):
      '''
      Resolve the image ID and pull the image if necessary
      '''
      image_id = __salt__['docker.resolve_image_id'](image)
  
      if image_id is False:
          if not __opts__['test']:
              # Image not pulled locally, so try pulling it
              try:
                  pull_result = __salt__['docker.pull'](
                      image,
                      client_timeout=client_timeout,
                  )
              except Exception as exc:
                  raise CommandExecutionError(
                      'Failed to pull {0}: {1}'.format(image, exc)
                  )
              else:
                  ret['changes']['image'] = pull_result
                  # Try resolving again now that we've pulled
                  image_id = __salt__['docker.resolve_image_id'](image)
                  if image_id is False:
                      # Shouldn't happen unless the pull failed
                      raise CommandExecutionError(
                          'Image \'{0}\' not present despite a docker pull '
                          'raising no errors'.format(image)
                      )
      return image_id
docs: Resolve the image ID and pull the image if necessary