def get(self, statediag, accepted=None):
        """
        Replaces complex state IDs as generated from the product operation,
        into simple sequencial numbers. A dictionaty is maintained in order
        to map the existed IDs.
        Args:
            statediag (list): The states of the PDA
            accepted (list): the list of DFA accepted states
        Returns:
            list:
        """
        count = 0
        statesmap = {}
        newstatediag = {}
        for state in statediag:

            # Simplify state IDs
            if statediag[state].id not in statesmap:
                statesmap[statediag[state].id] = count
                mapped = count
                count = count + 1
            else:
                mapped = statesmap[statediag[state].id]

            # Simplify transitions IDs

            transitions = {}
            for nextstate in statediag[state].trans:
                if nextstate not in statesmap:
                    statesmap[nextstate] = count
                    transmapped = count
                    count = count + 1
                else:
                    transmapped = statesmap[nextstate]
                transitions[transmapped] = statediag[state].trans[nextstate]
            newstate = PDAState()
            newstate.id = mapped
            newstate.type = statediag[state].type
            newstate.sym = statediag[state].sym
            newstate.trans = transitions
            newstatediag[mapped] = newstate
        newaccepted = None
        if accepted is not None:
            newaccepted = []
            for accepted_state in accepted :
                if (0, accepted_state) in statesmap:
                    newaccepted.append(statesmap[(0, accepted_state)])
        return newstatediag, count, newaccepted