https://medium.com/the-code-canvas/how-to-implement-custom-retry-mechanism-to-handle-server-side-errors-in-python-3e116a18af7f