Say $f$ is a newform of weight $k$ and level $\Gamma_1(N)$. $f$ is called CM if, for example, there is an imaginary quadratic field $K$ such that for all $p\nmid N$ which are inert in $K$, the $p$th Fourier coefficient $a_p$ of $f$ is 0. (Ribet's article *Galois representations attached to eigenforms with Nebentypus* is a nice reference for this material). Specific examples include the newforms attached to CM elliptic curves. All examples arise as inductions of algebraic Hecke characters of $K$ of type $(k-1,0)$.

Is there an effective bound in terms of $k$ and $N$ (or other basic invariants of $f$) on how many $a_p$ you have to check to know whether or not $f$ is CM? Or, is there an effective bound on the discriminant of the associated $K$ and the conductor of the associated algebraic Hecke character? What if we assume GRH?

A related question was asked here by Mike Bennett, but no answer has been given.

My motivation is simply to be able to computationally check if a given newform is CM using, say, SAGE. Thanks.