I guess this is what you meant

    if u.is_Add:
        u = factor_terms(match[b]).as_independent(f(x))[1]