from pathlib import Path


def is_python_module_directory(directory):
    """
    Checks if directory is python module directory
    """
    directory = Path(directory)
    if not directory.exists() or not directory.is_dir():
        return False

    # Detect if directory name is valid python identifier
    if not str(directory.name).isidentifier():
        return False

    # Detect __init__.py file
    if directory.joinpath('__init__.py').exists():
        return True

    return False