def isPackage ( file_path ) : return ( os . path . isdir ( file_path ) and os . path . isfile ( os . path . join ( file_path , '__init__.py' ) ) )
how can you check if python is in path
Determine whether or not a given path is a ( sub ) package or not .
def isPackage(file_path):
    """
    Determine whether or not a given path is a (sub)package or not.
    """
    return (os.path.isdir(file_path) and
            os.path.isfile(os.path.join(file_path, '__init__.py')))