<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def coerce_to_indices(self, nodes):
 """Return the nodes indices for nodes, where ``nodes`` is either already integer indices or node labels. """

        if nodes is None:
            return self.node_indices

        if all(isinstance(node, str) for node in nodes):
            indices = self.labels2indices(nodes)
        else:
            indices = map(int, nodes)
        return tuple(sorted(set(indices)))