code: def _ha_gen_method(func):
          ''' Method decorator for 'generator type' methods '''
          def wrapped(self, *args, **kw):
              self._reset_retries()
              while(True): # switch between all namenodes
                  try:
                      results = func(self, *args, **kw)
                      while(True): # yield all results
                          yield results.next()
                  except RequestError as e:
                      self.__handle_request_error(e)
                  except socket.error as e:
                      self.__handle_socket_error(e)
          return wrappef _ha_gen_method(func):
          ''' Method decorator for 'generator type' methods '''
          def wrapped(self, *args, **kw):
              self._reset_retries()
              while(True): # switch between all namenodes
                  try:
                      results = func(self, *args, **kw)
                      while(True): # yield all results
                          yield results.next()
                  except RequestError as e:
                      self.__handle_request_error(e)
                  except socket.error as e:
                      self.__handle_socket_error(e)
          return wrapped
docs: Method decorator for 'generator type' methods