from sympy import Symbol
x = Symbol('x')
equation = x**2 + 2**x - 2*x - 5**x + 1
Here, in this equation, for example, the polynomial part is x**2 - 2*x + 1 while the non-polynomial part is 2**x - 5**x.
Given an equation, how to extract the polynomial and the non-polynomial parts of it?