code: def handle_frontend_method(
      *,
      class_tree: str,
      init_tree: str,
      method_name: str,
      init_num_positional_args=None,
      init_native_arrays=BuiltNativeArrayStrategy,
      init_as_variable_flags=BuiltAsVariableStrategy,
      test_trace=BuiltTraceStrategy,
      precision_mode=BuiltPrecisionModeStrategy,
      method_num_positional_args=None,
      method_native_arrays=BuiltNativeArrayStrategy,
      method_as_variable_flags=BuiltAsVariableStrategy,
      test_inplace=BuiltInplaceStrategy,
      generate_frontend_arrays=BuiltFrontendArrayStrategy,
      **_given_kwargs,
  ):
      """Test wrapper for Ivy frontends methods.
  
      The wrapper sets the required test globals and creates
      test flags strategies.
  
      Parameters
      ----------
      class_tree
          Full class import path
  
      init_tree
          Full import path for the function used to create the class
  
      method_name
          Name of the method
  
      init_num_positional_args
          A search strategy that generates a number of positional arguments
          to be passed during instantiation of the class
  
      init_native_arrays
          A search strategy that generates a boolean to test the method with native
          arrays
  
      init_as_variable_flags
          A search strategy that generates a list of boolean flags for array inputs to be
          passed as a Variable array
  
      test_compile
          A search strategy that generates a boolean to graph compile and test the
          function
  
      precision_mode
          A search strategy that generates a boolean to switch between two different
          precision modes supported by numpy and (torch, jax) and test the function
  
      method_num_positional_args
          A search strategy that generates a number of positional arguments
          to be passed during call of the class method
  
      method_native_arrays
          A search strategy that generates a boolean to test the method with native
          arrays
  
      method_as_variable_flags
          A search strategy that generates a list of boolean flags for array inputs to be
          passed as a Variable array
  
      test_inplace
          A search strategy that generates a boolean to test the method with `inplace`
          update
      """
      split_index = init_tree.rfind(".")
      framework_init_module = init_tree[:split_index]
      ivy_init_module = (
          f"ivy.functional.frontends.{init_tree[:split_index]}"
      )
      init_name = init_tree[split_index + 1 :]
      init_tree = f"ivy.functional.frontends.{init_tree}"
      is_hypothesis_test = len(_given_kwargs) != 0
  
      split_index = class_tree.rfind(".")
      class_module_path, class_name = (
          class_tree[:split_index],
          class_tree[split_index + 1 :],
      )
      class_module = importlib.import_module(class_module_path)
      method_class = getattr(class_module, class_name)
  
      if is_hypothesis_test:
          callable_method = getattr(method_class, method_name)
          if init_num_positional_args is None:
              init_num_positional_args = num_positional_args(
                  fn_name=init_tree
              )
  
          if method_num_positional_args is None:
              method_num_positional_args = num_positional_args_method(
                  method=callable_method
              )
  
      def test_wrapper(test_fn):
          supported_device_dtypes = (
              _get_method_supported_devices_dtypes(
                  method_name, class_module, class_name
              )
          )
  
          if is_hypothesis_test:
              param_names = inspect.signature(test_fn).parameters.keys()
              init_flags = pf.frontend_init_flags(
                  num_positional_args=init_num_positional_args,
                  as_variable=_get_runtime_flag_value(
                      init_as_variable_flags
                  ),
                  native_arrays=_get_runtime_flag_value(
                      init_native_arrays
                  ),
              )
  
              method_flags = pf.frontend_method_flags(
                  num_positional_args=method_num_positional_args,
                  inplace=_get_runtime_flag_value(test_inplace),
                  as_variable=_get_runtime_flag_value(
                      method_as_variable_flags
                  ),
                  native_arrays=_get_runtime_flag_value(
                      method_native_arrays
                  ),
                  test_trace=_get_runtime_flag_value(test_trace),
                  precision_mode=_get_runtime_flag_value(
                      precision_mode
                  ),
                  generate_frontend_arrays=_get_runtime_flag_value(
                      generate_frontend_arrays
                  ),
              )
              ivy_init_modules = str(ivy_init_module)
              framework_init_modules = str(framework_init_module)
              frontend_helper_data = FrontendMethodData(
                  ivy_init_module=ivy_init_modules,
                  framework_init_module=framework_init_modules,
                  init_name=init_name,
                  method_name=method_name,
              )
  
              possible_arguments = {
                  "init_flags": init_flags,
                  "method_flags": method_flags,
                  "frontend_method_data": st.just(frontend_helper_data),
              }
  
              filtered_args = set(param_names).intersection(
                  possible_arguments.keys()
              )
              for key in filtered_args:
                  # extend Hypothesis given kwargs with our strategies
                  _given_kwargs[key] = possible_arguments[key]
  
              hypothesis_test_fn = given(**_given_kwargs)(test_fn)
  
              @functools.wraps(hypothesis_test_fn)
              def wrapped_test(*args, **kwargs):
                  try:
                      hypothesis_test_fn(*args, **kwargs)
                  except Exception as e:
                      # A string matching is used instead of actual exception due to
                      # exception object in with_backend is different from global Ivy
                      if (
                          e.__class__.__qualname__
                          == "IvyNotImplementedException"
                      ):
                          pytest.skip(
                              "Function not implemented in backend."
                          )
                      else:
                          raise e
  
          else:
              wrapped_test = test_fn
  
          wrapped_test.test_data = TestData(
              test_fn=wrapped_test,
              fn_tree=f"{init_tree}.{method_name}",
              fn_name=method_name,
              supported_device_dtypes=supported_device_dtypes,
              is_method=[method_name, class_tree, split_index],
          )
  
          return wrapped_test
  
      return test_wrapper
  
imports: import json
  import os
  import pytest
  import importlib
  import inspect
  import functools
  from typing import List, Optional
  from hypothesis import given, strategies
  import ivy.functional.frontends.numpy
  from .hypothesis_helpers import number_helpers
  from .globals import TestData
  from .None import test_parameter_flags
  from .None import test_globals
  from .pipeline_helper import BackendHandler
  from ivy_tests.test_ivy.helpers.test_parameter_flags import DynamicFlag, BuiltInstanceStrategy, BuiltAsVariableStrategy, BuiltNativeArrayStrategy, BuiltGradientStrategy, BuiltContainerStrategy, BuiltWithOutStrategy, BuiltWithCopyStrategy, BuiltInplaceStrategy, BuiltTraceStrategy, BuiltFrontendArrayStrategy, BuiltTranspileStrategy, BuiltPrecisionModeStrategy, BuiltCythonWrapperStrategy
  from ivy_tests.test_ivy.helpers.structs import FrontendMethodData
  from ivy_tests.test_ivy.helpers.available_frameworks import available_frameworks
  from ivy_tests.test_ivy.helpers.hypothesis_helpers.dtype_helpers import _dtype_kind_keys, _get_type_dict
  from .globals import mod_backend
label_desc: Use image node_id 15 for calling a global function with example usage: handle_frontend_method() and returns: test_wrapper, wrapped_test