In the appendix Takesaki's book on theory of operator algebras, he showed that if $f$ is a Borel map from a metric space $X$ to a metric space $Y$, then the graph of $f$ is a Borel set of $X \times Y$. An important step in this proof is the following:
If $(Z, d)$ is a metric space and $g: Z \to Z\,$ is a Borel map, then $z \mapsto d(z, g(z))$ is a Borel map from $Z$ to $\mathbb{R}$.
I can understand the above statement if $Z$ is separable. However, I fail to see how to prove it in the general case when the metric space $Z$ is not separable. Any help is appreciated.