def filter_test_cases_by_params(params: Dict[TestEnv, List[Tuple[Any]]]):
    """Filters test cases to run by given params.

    The params corresponding to any test env compatible with
    the local test env are kept.
    """
    target = detect_target()
    test_env = _get_test_env(target)
    input_ = list(
        itertools.chain.from_iterable(
            values
            for env, values in params.items()
            if env in _COMPATIBLE_TEST_ENVS[test_env]
        )
    )
    return {
        "input": input_,
        "skip_on_empty": True,
    }
Filters test cases to run by given params.

The params corresponding to any test env compatible with
the local test env are kept.
python/aitemplate/testing/test_utils.py