zeros and poles of $\operatorname{Im} f(z) / \operatorname{ Im z }>0$ using argument's principle Hi everyone I find the following exercise and honestly I'm stuck and I can't see how to use the argument's principle in any way. I'd appreciate any help with the exercise. Thank you.

Let $f$ a mermorphic function defined on $\mathbb C$ and suppose that $\operatorname{Im} f(z) / \operatorname{ Im z }>0$ for all $z$ outside of the real axis.
Show that the poles and zeros of $f$ belongs to $\mathbb R$ and the zeros and poles are interlaced, that is, between two adjacent poles there is exactly a zero and between two adjacent zeros there is a pole (use the argument's principle).

 A: (1) So $w= f(z)$ maps the upper half of the $z$ plane into the upper half of the $w$ plane, and maps the lower half of the $z$ plane into the lower half of the $w$ plane.
As $z(t) $ executes a small simple oriented loop $z=\gamma(t)$ in the $z$ plane the image curve $\Gamma (t) = w(t)= f(z(t))$ traces a closed curve in the $w$ plane . The Argument Principle tells us that this winding number of $\Gamma$ about $w=0$ equals $Z-P$, the difference between the number of zeros and poles of $f(z)$ inside $\gamma$. 
The winding number  of $\Gamma$ is evidently zero if $\Gamma$ lies strictly on one side of the real $w$ axis. Thus by (1) there are no zeros or poles of $f(z)$  inside  $\gamma$ unless the small loop $\gamma$ straddles the real $z$ axis.   
The remainder of the problem can be solved by (2) modeling the meromorphic function locally near a real zero or pole as $f(z)= c z^k$ and  thinking about what restrictions that places on $c$ and $k$.  Next (3) consider the image of a narrow rectangular curve $\gamma$ that encloses adjacent zeros of $f$. 
A: I have a solution that doesn't use the argument principle.
Let $H^+,H_-$ be the open upper and lower half planes.The condition on $f$ implies $f(H^+)\subset H^+,$ $f(H^-)\subset H^-.$ Letting $Z$ be the set of zeros of $f,$ we see $Z\subset \mathbb R.$
Let $P$ be the set of poles of $f.$ Suppose $a\in H^+\cap P.$ Choose $r>0$ such that $D(a,r)\subset H^+.$ Because $a$ is a pole of $f,$ $f(D'(a,r))\supset \{|z|>R\}$ for some $R>0.$ (Here $D'$ means punctured disc.) That's a contradiction, since $f(D'(a,r))\subset H^+.$ Thus $f$ has no poles in $H^+.$ Similarly $f$ has no poles in $H^-.$ Thus $P\subset\mathbb R.$
Note that if $a\in \mathbb R\setminus P,$ then $f(a) =\lim_{h\to 0^+} f(a+ih).$ This implies $\text{ Im }f(a)\ge 0.$ Similarly, $\text{ Im }f(a)\le 0.$ It follows that $f(a)\in \mathbb R.$ So we have $f$ real on the real axis, except for poles.
Claim: $f'(a)\ne 0$ for all $a\in \mathbb R\setminus P.$
Proof: If not, then let $a\in \mathbb R\setminus P$ be such that  $f'(a)\ne 0.$ Then for $z$ near $a,$ $f(z)= f(a) + c(z-a)^m + O((z-a)^{m+1})$ for some real constant $c\ne 0$ and some $m\in \{2,3,\dots\}.$ WLOG $c>0.$ Then
$$\tag 1 f(a+re^{i\pi 5/(4m)}) = f(a) + cr^me^{i\pi 5/4} +O(r^{m+1}).$$
Because $c>0,$ the right side of $(1)$ is in $H^-$ for small $r>0.$ But $a+re^{i\pi 5/(4m)} \in H_+$ for all $r>0,$ hence so is $f(a+re^{i\pi 5/(4m)}).$ This contradiction proves the claim.
Now to the final destination. Suppose $a,b$ are adjacent zeros of $f.$ If there is no pole of $f$ in $(a,b)$ then for some $\delta>0,$ $f(x)$ is a real differentiable function on $(a-\delta,b+\delta)$ with $f'\ne 0$ in this interval (by the claim). But $f(a)=f(b)=0.$ This contradicts Rolle's theorem. It follows that $f$ has a pole between adjacent zeros of $f.$
Now suppose $f$ has adjacent poles $a,b.$ Then $f$ is a real differentiable function on $(a,b)$ with singularities at both $a,b.$ Furthermore, we know $f'\ne 0$ on this interval by the claim. It follows that $f$ resticted to $(a,b)$ is a bijection onto $\mathbb  R.$ Thus $f(c)=0$ for one and only one $c\in (a,b).$
So between adjacent poles we have a unique zero of $f,$ and between adjacent zeros we have a pole. Could we have more than one pole between adjacent zeros? No, because if  we did, there would be a zero between these poles, showing the adjacent zeros were not adjacent after all, contradiction.
A: The first thing to observe is that $Im(f(z))/Im(z)>0$ on $\mathbb{C}\setminus\mathbb{R}$ implies that $Im(f)\neq 0$ outside $\mathbb{R}.$ In particular, $f$ does not have a zero outside $\mathbb{R}.$
Next, observe that if $\gamma$ is a curve that lies entirely in upper half-plane or the lower half plane, then $f\circ\gamma$ also lies entirely in the upper half plane or lower half-plane. In particular, the winding number of $f\circ\gamma$ about $0$ is $0.$ It follows from the argument principle that $f$ has no pole in the $\mathbb{C}\setminus\mathbb{R}.$
The last bit is to see that (**)“if $\gamma$ is a simple closed curve in $\mathbb{C}$ (possible intersecting $\mathbb{R}$), then the winding number of $f\circ\gamma$ about $0$ is either $0$ or $\pm 1.$” (I will leave the justification to you, but if you see it geometrically why this happens, you should be able to write it rigorously.)
Note that (**) Implies your claim. For if there are two consecutive zeroes or poles on $\mathbb{R},$ you can make a circle $\gamma$ such that the two consecutive zeros (or poles) are inside the circle (and no other zero or pole). Argument principle tells you that winding number of $f\circ\gamma$ about $0$ is $2$ Or $-2.$
(In fact, it also follows that every zero and pole is simple.)
