code: def _blocking_pop(self, pop_func, keys, timeout):
          
          if not isinstance(timeout, (int, long)):
              raise RuntimeError('timeout is not an integer or out of range')
  
          if timeout is None or timeout == 0:
              timeout = self.blocking_timeout
  
          if isinstance(keys, basestring):
              keys = [keys]
          else:
              keys = list(keys)
  
          elapsed_time = 0
          start = time.time()
          while elapsed_time < timeout:
              key, val = self._pop_first_available(pop_func, keys)
              if val:
                  return key, val
              # small delay to avoid high cpu utilization
              time.sleep(self.blocking_sleep_interval)
              elapsed_time = time.time() - start
          return None
docs: Emulate blocking pop functionality