Q:

how to use an if statement to check if something is visible?

I'm trying to write an if statement where if an alert appears (inner_modal_visible), then click on the continue button (using XPATH for now to test but will change it to class once I know it works on xpath), else continue clicking on inbound_seat.click() 
If I actually remove the xpath continue button code outside and in the if statement, then it selects all inbound_seats, but obviously I cannot continue. If I add the continue button code back in, then I get the error below after I select one inbound_seat. 
What am I doing wrong and how can I get the if statement to work so that if the alear appears, then click the continue button when it's clickable, else continue selecting the inbound seats?
Traceback (most recent call last):
      File "C:\Users\mayur\Documents\Selenium\Return Flight - no products.py", line 314, in <module>
        wait.until(EC.element_to_be_clickable((By.XPATH, "/html/body/div[3]/form/div[1]/div/div[1]/div[12]/div[2]/p[2]/button"))).click();
      File "C:\Python27\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
        raise TimeoutException(message, screen, stacktrace)
    TimeoutException: Message: 

Code:
 # choose seats
if inbound_has_infant:
    # select a non-selected infant seat
    inbound_seat = driver.find_element_by_css_selector(".inbound .planebody a.seat.infant:not(.reserved):not(.selected)")
else:
    # select a non-reserved non-selected seat
    inbound_seat = driver.find_element_by_css_selector(".inbound .planebody a.seat:not(.reserved):not(.selected)")

print("Passenger: %s, choosing seat: %s" % (inbound_passenger.text.strip(), inbound_seat.get_attribute("data-seat")))
inbound_seat.click()

modal_inner_visible = driver.find_element_by_id("AllInboundPassengersSeatedOk")

if modal_inner_visible.is_displayed():
    #confirm seats reserved
    wait.until(EC.element_to_be_clickable((By.XPATH, "/html/body/div[3]/form/div[1]/div/div[1]/div[12]/div[2]/p[2]/button"))).click();

else:
    #continue selecting seats
    inbound_seat.click()

A:

After looping over the passengers, wait for "clickability" of the appropriate Continue button:
for inbound_passenger in driver.find_elements_by_css_selector("ol[data-flightbound='Inbound'] li[data-personid]"):
    inbound_passenger.click()
    inbound_has_infant = inbound_passenger.get_attribute("data-hasinfant")

    # choose seats
    if inbound_has_infant:
        # select a non-selected infant seat
        inbound_seat = driver.find_element_by_css_selector(".inbound .planebody a.seat.infant:not(.reserved):not(.selected)")
    else:
        # select a non-reserved non-selected seat
        inbound_seat = driver.find_element_by_css_selector(".inbound .planebody a.seat:not(.reserved):not(.selected)")

    print("Passenger: %s, choosing seat: %s" % (inbound_passenger.text.strip(), inbound_seat.get_attribute("data-seat")))
    inbound_seat.click()

# proceed to the next page
submit_seat_selection = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "#AllInboundPassengersSeatedOk button.submitseatselection")))
submit_seat_selection.click()

