I figured out the correct import based on what was done previously. It worked.
">>> from mailman.app.moderator import handle_message
requestdb = IListRequests(m) for req in requestdb.held_requests: ... if req.request_type == RequestType.held_message: ... if not requestdb.get_request(req.id): ... print(f'Bad request id: {req.id}, deleting') ... requestdb.delete_request(req.id) ... Bad request id: 1694, deleting Bad request id: 2509, deleting Bad request id: 2727, deleting Bad request id: 3251, deleting Bad request id: 3265, deleting Bad request id: 3371, deleting Bad request id: 4844, deleting Bad request id: 6058, deleting Bad request id: 6201, deleting Bad request id: 6432, deleting Bad request id: 6502, deleting commit ()"