ODE: Incorporate imaginary constants in classify_ode of undetermined_coeff fixes #5787

In issue https://github.com/sympy/sympy/issues/5787, there was no
condition to classify imaginary constants which caused the issue to
fail in case of undetermined coefficients. This patch have a condition
added to classify it.

fixes #5787