def METHOD_NAME(results):
    if "results" in results:
        # This must be the registered result of a loop of route53 tasks
        for key in ("changed", "msg", "skipped"):
            if key not in results:
                raise ValueError(f"missing {key} key")
        if not isinstance(results["results"], list):
            raise ValueError("results is present, but not a list")
        for index, result in enumerate(results["results"]):
            if not isinstance(result, dict):
                raise ValueError(f"result {index + 1} is not a dictionary")
            for key in ("changed", "failed", "ansible_loop_var", "invocation"):
                if key not in result:
                    raise ValueError(f"missing {key} key for result {index + 1}")
            yield f" for result #{index + 1}", result
        return
    # This must be a single route53 task
    for key in ("changed", "failed"):
        if key not in results:
            raise ValueError(f"missing {key} key")
    yield "", results