Wrap mock import to avoid ImportErrors
Remove trailing whitespace and fix PEP8 issues