Added an error handling in 503 error case.
Applied PEP8.