Error codes

Added 500 and 429 error handlers and made some basic PEP8 formatting changes to the if-statements.