Help needed in proving an result about a function with only poles as singularity This question was part of my assignment in complex analysis and I was unable to solve it and hence asking for help here.

Show that $~f(z)~$ has no singularities in extended plane other than poles if and only if $~f(z)~$ is quotient of $~2~$ polynomials.

Assuming $~f(z)~$ is quotient of $~2~$ polynomials I have proved that only singularities are poles but I am having trouble in proving the converse.
Let function be $~p(z)=  f(z) \left[1/(z-z_0)^{m_0}  + \cdots +1/(z-z_r)^{ m_r} \right]~,$ where $~f(z)~$ is analytic but how to prove that $~f(z)~$ must be a polynomial ?
Thank you!!
 A: Question: Show that $f(z)$ has no singularities in extended plane other than poles if and only if $f(z)$ is quotient of $~2~$ polynomials.
Answer: Let $f(z)$ be the quotient of two polynomials, say, $$f(z)=\dfrac{p(z)}{q(z)}~,\tag1$$ where
$~p(z) = α_0 + α_1z + α_2z^2 +\cdots + α_nz^n~$ and $~q(z) = β_0 + β_1z + β_2z^2 + \cdots + β_mz^m~.$ Clearly, the polynomials $~p(z)~$ and $~q(z)~$ are analytic at all finite points on the complex plane.
Let us assume that $~p(z)~$ and $~q(z)~$ have no common zeros;
if they do have a common zero at $~z = z_0~,$ it is always possible to write $~f(z)~$ as the quotient of two polynomials with no common zeros by canceling a suitable number of the $~(z − z_0)$ factors.
Obviously, the only possible singularities of $~f(z)~$ are situated at the zeros
of $~q(z)~.$ Since the zeros of $~p(z)~$ do not coincide with those of $~q(z),~$ so $~f(z)~$ necessarily diverges at the zeros of $~q(z)~.$ Such points can be poles but not essential singularities in view of the Weierstrass theorem. Thus all singularities of rational functions $~f(z)~$ are necessarily poles.
To prove the converse, suppose that all the singularities of an analytic function $~f(z)~$ are poles at the points $~a_1,~a_2,~\cdots ,~a_n~.$ The orders of these poles
are denoted by $~m_1,~m_2,~ \cdots ,~m_n~,$ respectively. In the vicinity of the point $~a_ν~,$ the function $~f(z)~$ has a Laurent series expansion of the form
$$f(z)=\dfrac{c_{-m_v}^{(v)}}{(z-a_v)^{m_v}}+\dfrac{c_{-m_v-1}^{(v)}}{(z-a_v)^{m_v-1}}+\cdots+\dfrac{c_{-1}^{(v)}}{(z-a_v)}+\sum_{\mu=0}^\infty c^{(u)}_\mu (z-a_v)^\mu~,$$where the superscripts $~(ν)~$ on $~c^{(ν)}~$ indicate that they are the coefficients that belong to the $ν$th poles, $~z = a_ν~.$ Denote the principal part by
$$g_v(z)=\dfrac{c_{-m_v}^{(v)}}{(z-a_v)^{m_v}}+\dfrac{c_{-m_v-1}^{(v)}}{(z-a_v)^{m_v-1}}+\cdots+\dfrac{c_{-1}^{(v)}}{(z-a_v)}$$and consider the expression $$h(z)=f(z)-g_1(z)-g_2(z)-\cdots-g_n(z)=f(z)-\sum_{v=1}^n g_v(z)~.$$ Since $~f(z) − g_ν(z)~$ is analytic at $~z = a_ν~,$ and $~g_ν(z)~$ is analytic everywhere
except at $~z = a_ν~,$ it follows that $h(z)$ is analytic at all points of the complex
plane, including the point at infinity. In view of Liouville’s theorem such a
function is necessarily a constant. Thus we have identically $~h(z) ≡ γ_0~,$ whence
$$f(z)=\gamma_0+\sum_{v=1}^n g_v(z)$$which implies that $~f(z)~$ can be brought into the form equation $(1)$. This completes the proof of our theorem.

Ref.: Higher Mathematics for Physics and Engineering: Mathematical Methods for Contemporary Physics by Tsuneyoshi Nakayama & Hiroyuki Shima
