def contains_term(email, terms):
    """ Return a boolean indicating whether an email contains any of the given
    sub-terms. Helper for filter_emails.

    """
    contains = False
    if isinstance(email,(str,)):
        for term in terms:
            if isinstance(term,(str,)):
                if term.lower() in email.lower():
                    contains = True
                    break
    return contains