<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def terminate_process(self, idf):
 """ Terminate a process by id """

        try:
            p = self.q.pop(idf)
            p.terminate()
            return p
        except:
            return None