Generalizations of the Tietze extension theorem (and Lusin's theorem) I am reasking a year-old math.stackexchange.com question asked by someone else.
(For my needs every space $X$ and $Y$ will be Polish---that is a completely separably metrizable space.)
The Tietze extension theorem says that if $X$ is a Polish space (even a normal space) and $Y=\mathbb{R}^n$, then a continuous function $f:C \rightarrow Y$ on a closed set $C \subseteq X$ can be extended to a continuous function $g:X \rightarrow Y$.
It seems important to the theorem in general that $Y = \mathbb{R}^n$, however there are some examples of pairs $X,Y$ where the theorem also holds.  For example, it is true if $X, Y \in \{2^\mathbb{N},\mathbb{N}^\mathbb{N}\}$.  (Although, other pairs like $X=\mathbb{R}, Y = 2^\mathbb{N}$ do not hold.)

Is there a characterization of the pairs $X,Y$ (or $X,Y,C$) for which the Tietze extension theorem holds?
If not, what extensions are known, especially those that include my $2^\mathbb{N}$ example above?


One motivation for asking this question is Lusin's theorem:
If $(X,\mathcal{B},P)$ is a Borel probability measure on a Polish space $X$ (even a Radon measure on a finite measure space) and $f:X \rightarrow Y$ is a measurable map (again $Y$ is Polish, or even second countable), then for all $\varepsilon > 0$, there is a closed set $C$ of measure $1-\varepsilon$ such that $f$ is continuous on $C$.
If $Y$ is $\mathbb{R}^n$, we can apply the Tietze extension theorem to find some continuous $g:X \rightarrow Y$ such that $g = f$ on $C$.  Wikipedia currently (12 July 2013) has a false statement that for any locally compact $X$ we can find such a continuous $g:X \rightarrow Y$.  For a counterexample, take $X=[0,1]$ and $Y=2^\mathbb{N}$ and $f$ to be the bit representation of the reals.
I am interested in which cases this stronger version of Lusin's thoerem (with the continuous $g:X \rightarrow Y$) holds.
 A: A compact space $Y$ is called an absolute extensor in dimension $0$ abbreviated $AE(0)$ if the pair $X,Y$ satisfies Tietze extension theorem for every compact zero-dimensional $X$. Any compact (retract of a) topological group is $AE(0)$ (Schepin/Uspenski). In particular $2^\mathbb{N}$ is $AE(0)$. In fact, Schepin proved that the only zero-dimensional $AE(0)$ space with character $\kappa$ at every point is $2^\kappa$.
A: There is a nice characterization of the spaces $X$ where the Tietze extension theorem holds for all complete separable metric spaces $Y$. We say that a Hausdorff space $X$ is ultranormal if whenever $R,S$ are disjoint closed subsets of $X$, then there is some clopen set $C$ with $R\subseteq C$ and $S\subseteq C^{c}$. A Hausdorff space $X$ is ultraparacompact if every open cover of $X$ is refinable by a partition of $X$ into clopen sets. Every ultraparacompact space is ultranormal, every ultranormal space is zero-dimensional, and every ultranormal metric space is ultraparacompact. Furthermore, a space is ultraparacompact if and only if it is paracompact and ultranormal. Every zero-dimensional separable metric space is ultraparacompact and hence ultranormal. Therefore for separable metric spaces, the notions of ultranormality, ultraparacompactness, and zero-dimensionality coincide. See my paper for more information on ultranormality and ultraparacompactness. This paper is an expanded version of a long answer I gave to this question here on MO.
$\mathbf{Theorem}$ (Ellis)


*

*Let $X$ be a Hausdorff space. Then $X$ is ultranormal if and only if whenever $C\subseteq X$ is a closed subspace, $Y$ is a complete separable metric space, $C\subseteq X$ is a closed subspace, then every map from $C$ to $Y$ can be extended to a map from $X$ to $Y$.

*Let $X$ be an ultraparacompact space and let $C$ be a closed subspace of $X$. Let $Y$ be a complete metric space. Then every continuous map from $C$ to $Y$ can be extended to a map from $X$ to $Y$.///
For a proof of the above result, see the paper Extending Continuous Functions on Zero-Dimensional Spaces by Robert Ellis.
