'Checks if a given `entry` passes `condition`'

def check_condition(self, condition, entry):

    eval_locals = copy(entry)
    eval_locals.update({u'has_field': (lambda f: (f in entry)), u'timedelta': datetime.timedelta, u'utcnow': datetime.datetime.utcnow(), u'now': datetime.datetime.now()})
    try:
        passed = evaluate_expression(condition, eval_locals)
        if passed:
            log.debug((u'%s    matched    requirement    %s' % (entry[u'title'], condition)))
        return passed
    except UndefinedError as e:
        missing_field = e.args[0].split(u"'")[1]
        log.debug((u'%s    does    not    contain    the    field    %s' % (entry[u'title'], missing_field)))
    except Exception as e:
        log.error((u'Error    occurred    while    evaluating    statement    `%s`.    (%s)' % (condition, e)))
