from sysconfig import get_config_var
m = __import__(filename[:-3] if filename.endswith('.py') else filename.
    replace(get_config_var('EXT_SUFFIX'), ''))
Doctests fail with UnicodeDecodeError on C-extension and Python3