Modify api views code for compliance with PEP8