text: # Code generated by protoc-gen-twirp_python v7.2.0, DO NOT EDIT.
  # source: y/y.proto
  
  try:
      import httplib
      from urllib2 import Request, HTTPError, urlopen
  except ImportError:
      import http.client as httplib
      from urllib.request import Request, urlopen
      from urllib.error import HTTPError
  import json
  from google.protobuf import symbol_database as _symbol_database
  import sys
  
  _sym_db = _symbol_database.Default()
  
  class TwirpException(httplib.HTTPException):
      def __init__(self, code, message, meta):
          self.code = code
          self.message = message
          self.meta = meta
          super(TwirpException, self).__init__(message)
  
      @classmethod
      def from_http_err(cls, err):
          try:
              jsonerr = json.load(err)
              code = jsonerr["code"]
              msg = jsonerr["msg"]
              meta = jsonerr.get("meta")
              if meta is None:
                  meta = {}
          except:
              code = "internal"
              msg = "Error from intermediary with HTTP status code {} {}".format(
                  err.code, httplib.responses[err.code],
              )
              meta = {}
          return cls(code, msg, meta)
  
  