code: def wait_for_focus(self, title, timeOut=5):
          
          regex = re.compile(title)
          waited = 0
          while waited <= timeOut:
              if regex.match(self.mediator.interface.get_window_title()):
                  return True
              
              if timeOut == 0:
                  break  # zero length timeout, if not matched go straight to end
                  
              time.sleep(0.3)
              waited += 0.3
              
          return False
docs: Wait for window with the given title to have focus
          
          Usage: C{window.wait_for_focus(title, timeOut=5)}
          
          If the window becomes active, returns True. Otherwise, returns False if
          the window has not become active by the time the timeout has elapsed.
          
          @param title: title to match against (as a regular expression)
          @param timeOut: period (seconds) to wait before giving up
          @rtype: boolean