def _DatastoreExceptionFromCanonicalErrorCodeAndDetail(error, detail):
 exception_class = _CLOUD_DATASTORE_EXCEPTION_CLASSES.get(error, datastore_errors.InternalError)
 if (detail is None):
  return exception_class()
 else:
  return exception_class(detail)

def _DatastoreExceptionFromCanonicalErrorCodeAndDetail ( error , detail ) : exception_class = _CLOUD_DATASTORE_EXCEPTION_CLASSES . get ( error , datastore_errors . InternalError ) if ( detail is None ) : return exception_class ( ) else : return exception_class ( detail )
converts a canonical error code into a datastore_errors .