The line after `log = ....` is `import ...`.  The coding convention is to put imports at the top of the file.  So reorder the header of the file so imports appear before code.