code: def create_api_error_from_http_exception(e):
      
      response = e.response
      try:
          explanation = response.json()['message']
      except ValueError:
          explanation = (response.content or '').strip()
      cls = APIError
      if response.status_code == 404:
          if explanation and ('No such image' in str(explanation) or
                              'not found: does not exist or no pull access'
                              in str(explanation) or
                              'repository does not exist' in str(explanation)):
              cls = ImageNotFound
          else:
              cls = NotFound
      raise cls(e, response=response, explanation=explanation)
docs: Create a suitable APIError from requests.exceptions.HTTPError.