How to close websocket

How to gracefully shutdown handler or websocket. I found below one… but it was expecting to use async function in python. Pls let me know how to disconnect websocket in python…

handler.shutdown()