Execute a function after Flask returns response Execute a function after Flask returns response multithreading multithreading