def get_grandma(clause_atom, api):
    """Return a wayyiqtol/yiqtol/imperative from a clause tree.

    Recursively climbs up a clause's ancestorial tree.
    Stops upon identifying either wayyiqtol
    or a yiqtol|impv grand(mother).

    Returns:
        a string of the ancestor's tense, or None.
    """

    F, E, L = api.F, api.E, api.L

    this_verb = next((F.vt.v(w) for w in L.d(clause_atom) if F.pdp.v(w)=='verb'), '') 
    mother = next((m for m in E.mother.f(clause_atom)), 0)
    mom_verb = next((F.vt.v(w) for w in L.d(mother) if F.pdp.v(w)=='verb'), '')    

    if mom_verb in {'wayq', 'impf', 'impv'}:
        return mom_verb
    elif not mother:
        return this_verb
    else:
        return get_grandma(mother, api)