CLN: move import to top of file

For consistency with [PEP8][1]:

    Imports are always put at the top of the file, just after any module
    comments and docstrings, and before module globals and constants.

[1]: https://www.python.org/dev/peps/pep-0008#id17