def ansible_ping_func(modules):
    if "ansible.system.ping" in modules:
        # we need to go by getattr() because salt's loader will try to find "system" in the dictionary and fail
        # The ansible hack injects, in this case, "system.ping" as an attribute to the loaded module
        return getattr(modules.ansible, "system.ping")

    if "ansible.ping" in modules:
        # Ansible >= 2.10
        return modules.ansible.ping

    pytest.fail("Where is the ping function these days in Ansible?!")