Would this be better as a 
<code>
if where:
    try:
        self.accordion.current_content.get_node(location).click()
    except AttributeError:
        raise Exception("Could not find condition %s" % location)
else:
    .....
</code>