import ast


def eval_condition(condition, locals):
    """Evaluates the condition, if a given variable used in the condition
    isn't present, it defaults it to None
    """
    condition_variables = set()
    st = ast.parse(condition)
    for node in ast.walk(st):
        if type(node) is ast.Name:
            condition_variables.add(node.id)
    for v in condition_variables:
        if v not in locals:
            locals[v] = None
    result = eval(condition, {}, locals)
    return result