  This paper forms the second part of a series by the authors [GMV1,GMV3]
concerning the structure theory of nilspaces of Antol\'in Camarena and Szegedy.
A nilspace is a compact space $X$ together with closed collections of cubes
$C_n(X)\subseteq X^{2^n}$, $n=1,2,\ldots$ satisfying some natural axioms. From
these axioms it follows that a nilspace can be built as a finite tower of
extensions where each of the successive fibers is a compact abelian group.
  Our main result is a new proof of a result due to Antol\'in Camarena and
Szegedy [CS12], stating that if each of these groups is a torus then $X$ is
isomorphic (in a strong sense) to a nilmanifold $G/\Gamma$. We also extend the
theorem to a setting where the nilspace arises from a dynamical system $(X,T)$.
These theorems are a key stepping stone towards the general structure theorem
in [GMV3] (which again closely resembles the main theorem of [CS12]).
  The main technical tool, enabling us to deduce algebraic information from
topological data, consists of existence and uniqueness results for solutions of
certain natural functional equations, again modelled on the theory in [CS12].
