def isPackage(module):
 if (not isinstance(module, types.ModuleType)):
  return False
 basename = os.path.splitext(os.path.basename(module.__file__))[0]
 return (basename == '__init__')

def isPackage ( module ) : if ( not isinstance ( module , types . ModuleType ) ) : return False basename = os . path . splitext ( os . path . basename ( module . __file__ ) ) [ 0 ] return ( basename == '__init__' )
given an object return true if the object looks like a package .