def grammarJoin(l, sep=', ', lastSep=' and '):
    """Joins list p_l with p_sep, excepted the last 2 elements that are joined
       with p_lastSep. grammarJoin(["a", "b", "c"]) produces "a, b and c"."""
    r = ''
    i = 0
    last = len(l) - 1
    for elem in l:
        if i == last:
            curSep = ''
        elif i == last - 1:
            curSep = lastSep
        else:
            curSep = sep
        r += elem + curSep
        i += 1
    return r
