code: def test_args_intertwined(ray_start_regular):
      def args_intertwined(a, *args, x="hello", **kwargs):
          return a, args, x, kwargs
  
      class TestActor:
          def args_intertwined(self, a, *args, x="hello", **kwargs):
              return a, args, x, kwargs
  
          @classmethod
          def cls_args_intertwined(cls, a, *args, x="hello", **kwargs):
              return a, args, x, kwargs
  
      def test_function(fn, remote_fn):
          assert fn(1, 2, 3, x="hi", y="hello") == ray.get(
              remote_fn.remote(1, 2, 3, x="hi", y="hello")
          )
          assert fn(1, 2, 3, y="1hello") == ray.get(
              remote_fn.remote(1, 2, 3, y="1hello")
          )
          assert fn(1, y="1hello") == ray.get(
              remote_fn.remote(1, y="1hello")
          )
  
      remote_test_function = ray.remote(test_function)
  
      remote_args_intertwined = ray.remote(args_intertwined)
      test_function(args_intertwined, remote_args_intertwined)
      ray.get(
          remote_test_function.remote(
              args_intertwined, remote_args_intertwined
          )
      )
  
      remote_actor_class = ray.remote(TestActor)
      remote_actor = remote_actor_class.remote()
      actor_method = remote_actor.args_intertwined
      local_actor = TestActor()
      local_method = local_actor.args_intertwined
      test_function(local_method, actor_method)
      ray.get(remote_test_function.remote(local_method, actor_method))
  
      actor_method = remote_actor.cls_args_intertwined
      local_actor = TestActor()
      local_method = local_actor.cls_args_intertwined
      test_function(local_method, actor_method)
      ray.get(remote_test_function.remote(local_method, actor_method))
  
imports: import pytest
  import ray
  import ray.cluster_utils
label_desc: Use image node_id 2 for calling a global function with example usage: test_args_intertwined(ray_start_regular) and returns: a,  args,  x,  kwargs, a,  args,  x,  kwargs, a,  args,  x,  kwargs