def grit_patterns_dealias(mod: Union[ModuleType, str]) -> Iterable[str]:
    """Generate grit patterns for migrating from imports from the given module
    to what from where this module imports instead."""

    if isinstance(mod, str):
        mod_name = mod
    elif isinstance(mod, ModuleType):
        mod_name = mod.__name__
    else:
        raise ValueError(f"Unknown type {type(mod).__name__}")

    for name, ast_ in get_post_dep_imports(mod).items():
        if (new_qual := get_import_target(ast_)) is None:
            continue

        new_mod, new_name = new_qual

        yield f"`from {mod_name} import {name}` => `from {new_mod} import {new_name}`"
        yield f"`from {mod_name} import {name} as $alias` => `from {new_mod} import {new_name} as $alias`"
Generate grit patterns for migrating from imports from the given module
    to what from where this module imports instead.
.grit/dealias_trulens_eval.py