<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _squeeze(system):
 """Squeeze out all singleton dimensions in the Subsystem. Reindexes the subsystem so that the nodes are ``0..n`` where ``n`` is the number of internal indices in the system. """

        assert system.node_indices == tpm_indices(system.tpm)

        internal_indices = tpm_indices(system.tpm)

        tpm = remove_singleton_dimensions(system.tpm)

        # The connectivity matrix is the network's connectivity matrix, with
        # cut applied, with all connections to/from external nodes severed,
        # shrunk to the size of the internal nodes.
        cm = system.cm[np.ix_(internal_indices, internal_indices)]

        state = utils.state_of(internal_indices, system.state)

        # Re-index the subsystem nodes with the external nodes removed
        node_indices = reindex(internal_indices)
        nodes = generate_nodes(tpm, cm, state, node_indices)

        # Re-calcuate the tpm based on the results of the cut
        tpm = rebuild_system_tpm(node.tpm_on for node in nodes)

        return SystemAttrs(tpm, cm, node_indices, state)