def cancel_tasks_from_peer(self, peer_id: bytes32):
    if (peer_id not in self.tasks_from_peer):
        return None
    task_ids = self.tasks_from_peer[peer_id]
    for task_id in task_ids:
        if (task_id in self.execute_tasks):
            continue
        task = self.api_tasks[task_id]
        task.cancel()
def cancel_tasks_from_peer(self, peer_id: bytes32):
    if (peer_id not in self.tasks_from_peer):
        return None
    task_ids = self.tasks_from_peer[peer_id]
    for task_id in task_ids:
        if (task_id in self.execute_tasks):
            continue
        task = self.api_tasks[task_id]
        task.cancel()