Updated full solution
Python is not able to do the inverse Laplace transform for a general rational polynomial. Maybe there are advanced option I am not aware or maybe Mathematica could do it. Later I will take a shortcut by assigning values to a, b, f, g (e.g., a=1, b=2, f=3, g=4) to verify.
There could still be some errors in the formula before it is fully verified. But it is more or less close to the full solution.
