def containsElement(element):
    """
    Checks if the formula contains an element (specified as a string)
    """
    segment_has_element = lambda x: str(x.element()) == element and x.amount() >= 1

    def _filter(term):
        return any(segment_has_element(x) for x in term['_sf'].get_segments())

    return _filter