def _simplify_variable_coeff(sol, syms, func, funcarg):
 eta = Symbol('eta')
 if (len(syms) == 1):
  sym = syms.pop()
  final = sol.subs(sym, func(funcarg))
 else:
  fname = func.__name__
  for (key, sym) in enumerate(syms):
   tempfun = Function((fname + str(key)))
   final = sol.subs(sym, func(funcarg))
 return simplify(final.subs(eta, funcarg))

def _simplify_variable_coeff ( sol , syms , func , funcarg ) : eta = Symbol ( 'eta' ) if ( len ( syms ) == 1 ) : sym = syms . pop ( ) final = sol . subs ( sym , func ( funcarg ) ) else : fname = func . __name__ for ( key , sym ) in enumerate ( syms ) : tempfun = Function ( ( fname + str ( key ) ) ) final = sol . subs ( sym , func ( funcarg ) ) return simplify ( final . subs ( eta , funcarg ) )
helper function to replace constants by functions in 1st_linear_variable_coeff .