<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cleanup_candidates(self, node_ip):

 """
 Removes old TCP hole punching candidates for a
 designated node if a certain amount of time has passed
 since they last connected.
 """

        if node_ip in self.factory.candidates:
            old_candidates = []
            for candidate in self.factory.candidates[node_ip]:
                elapsed = int(time.time() - candidate["time"])
                if elapsed > self.challege_timeout:
                    old_candidates.append(candidate)

            for candidate in old_candidates:
                self.factory.candidates[node_ip].remove(candidate)