<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_finished(self):
 """ Clean up terminated processes and returns the list of their ids """

        indices  = []
        for idf, v in self.q.items():
            if v.poll() != None:
                indices.append(idf)

        for i in indices:
            self.q.pop(i)
        return indices