def site_info(s):
    return s.getId(), s.getName(), s.getCustomer().getId()
if site_info(site) == site_info(site_listing):
    return site_listing
else:
    continue
The Pythonic way of validating a long chain of conditions in Python