fix #787 check if we load a pyc file or not.

PR to fix #787.

The current change test if the filename ends with `.pyc` to know if i needs to load it differently or not. Other way would be testing on ImportError but I am worried of the possible side effect,
 
Please review and test. cc @jerynmathew  @tilgovi