Variables in function definition problem



Is there a function that will factor out a from an expression with
f(x) and g(x) arbitrary functions?

 
    a*f(x) + a*b*g(x) -->  a*( f(x) + b*g(x) )