def _object_client(self, *, not_found=None):
        """(Re-)initialize object client if required, handle 404 errors gracefully and reset the client on
        server errors.  Server errors have been shown to be caused by invalid state in the client and do not
        seem to be resolved without resetting."""
        if self.gs_object_client is None:
            if self.gs is None:
                self.gs = self._init_google_client()
            self.gs_object_client = self.gs.objects()  # pylint: disable=no-member

        try:
            yield self.gs_object_client
        except HttpError as ex:
            if ex.resp["status"] == "404" and not_found is not None:
                raise FileNotFoundFromStorageError(not_found)
            if ex.resp["status"] >= "500" and ex.resp["status"] <= "599":
                self.log.error("Received server error %r, resetting Google API client", ex.resp["status"])
                self.gs = None
                self.gs_object_client = None
            raise
def _object_client ( self , * , not_found = None ) : if self . gs_object_client is None : if self . gs is None : self . gs = self . _init_google_client ( ) self . gs_object_client = self . gs . objects ( ) try : yield self . gs_object_client except HttpError as ex : if ex . resp [ "status" ] == "404" and not_found is not None : raise FileNotFoundFromStorageError ( not_found ) if ex . resp [ "status" ] >= "500" and ex . resp [ "status" ] <= "599" : self . log . error ( "Received server error %r, resetting Google API client" , ex . resp [ "status" ] ) self . gs = None self . gs_object_client = None raise
(Re-)initialize object client if required, handle 404 errors gracefully and reset the client on
        server errors.  Server errors have been shown to be caused by invalid state in the client and do not
        seem to be resolved without resetting.