CLN: move import to top of file
For consistency with [PEP8](https://www.python.org/dev/peps/pep-0008#id17):

```
Imports are always put at the top of the file, just after any module
comments and docstrings, and before module globals and constants.
```
