Adjusting code for PEP08 and compatibility with django CMS 2.4