def chdir(__path: str) -> ContextManager:
    """Context handler to temporarily switch directories.

    Args:
        __path: Directory to change to

    Yields:
        Execution context in ``path``
    """
    old = os.getcwd()
    try:
        os.chdir(__path)
        yield
    finally:
        os.chdir(old)