Polynomial bounded real part of an entire function

Let $f(z)$ be an entire function whose real part is bounded by a polynomial in $|z|$. Does it follow that $f(z)$ is a polynomial?

Or, without loss of generality and more suggestively $$(f(z)=\sum_{k=0}^\infty a_k z^k \quad \land \quad \operatorname{Re}(f(z))\leq |z|^n)\quad \forall z\in \mathbb{C} \qquad \Rightarrow \qquad f(z)=\sum_{k=0}^n a_k z^k \quad\forall z\in \mathbb{C}$$


The answer is yes. Suppose that $f$ is an entire function such that $\operatorname{Re}(f(z))\leq |z|^n$ for all $z \in \mathbb{C}$. Let $0<r<R$. Then by the Carathéodory inequality, we have

$$|f(z)| \leq \frac{2r}{R-r} R^n + \frac{R+r}{R-r}|f(0)|$$ for every $|z|\leq r$. Now, if $a_k$'s are the Taylor coefficients of $f$, we have $$a_k = \frac{1}{2\pi i} \int_{|z|=r}\frac{f(z)}{z^{k+1}} dz$$ and thus $$|a_k| \leq \frac{1}{r^k}\left( \frac{2r}{R-r} R^n + \frac{R+r}{R-r}|f(0)|\right).$$ With $R=2r$, we obtain $$|a_k| \leq \frac{1}{r^k}\left( 2^{n+1}r^n + 3|f(0)|\right).$$ If $k>n$, this tends to zero as $r \rightarrow \infty$. It follows that $f$ is a polynomial of degree at most $n$.