def is_module_or_package(path):
 is_module = (osp.isfile(path) and (osp.splitext(path)[1] in ('.py', '.pyw')))
 is_package = (osp.isdir(path) and osp.isfile(osp.join(path, '__init__.py')))
 return (is_module or is_package)

def is_module_or_package ( path ) : is_module = ( osp . isfile ( path ) and ( osp . splitext ( path ) [ 1 ] in ( '.py' , '.pyw' ) ) ) is_package = ( osp . isdir ( path ) and osp . isfile ( osp . join ( path , '__init__.py' ) ) ) return ( is_module or is_package )
return true if path is a python module/package .