<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete_resource(self, resource):
 """ Deletes the resource from the pool and destroys the associated resource. Not usually needed by users of the pool, but called internally when BadResource is raised. :param resource: the resource to remove :type resource: Resource """

        with self.lock:
            self.resources.remove(resource)
        self.destroy_resource(resource.object)
        del resource