from pathlib import Path


def python_module(folder: Path, root: Path):
    """Returns the unique python module in folder relative to root"""
    modules = [f for f in Path(folder).glob("*.py")
               if "test" not in str(f) and "__init__.py" not in str(f)]
    if len(modules) == 1:  # Ensure there is a unique python module
        return str(modules[0].relative_to(root)).replace('/', '.')[:-3]
    else:
        return None