title: Create custom wait until condition in Python
body: <p>I tried to create a function with custom wait condition in Python. However, I get an error:</p>
  
  <blockquote>
    <p>TypeError: 'bool' object is not callable</p>
  </blockquote>
  
  <pre><code>def waittest(driver, locator, attr, value):
      element = driver.find_element_by_xpath(locator)
      if element.get_attribute(attr) == value:
          return element
      else:
          return False
  wait = WebDriverWait(driver, 10)
  element = wait.until(waittest(driver, '//div[@id="text"]', "myCSSClass", "false"))    
  </code></pre>