def local_defs(term, local):
    """
    term: term object
    local: list of local variables defined in the parent terms

    :returns: list of local vairables to be considered within the term
    """
    term = term.parent
    if term:
        if term.quantifier:
            for q_var in term.quantified_vars[0]:
                local.add(q_var)
        if term.let_terms:
            for var in term.var_binders:
                local.add(var)
        if term.parent:
            local_defs(term, local)
    return local