code: def handle_frontend_test(
      *,
      fn_tree: str,
      gt_fn_tree: Optional[str] = None,
      aliases: Optional[List[str]] = None,
      number_positional_args=None,
      test_with_out=BuiltWithOutStrategy,
      test_with_copy=BuiltWithCopyStrategy,
      test_inplace=BuiltInplaceStrategy,
      as_variable_flags=BuiltAsVariableStrategy,
      native_array_flags=BuiltNativeArrayStrategy,
      test_trace=BuiltTraceStrategy,
      generate_frontend_arrays=BuiltFrontendArrayStrategy,
      transpile=BuiltTranspileStrategy,
      precision_mode=BuiltPrecisionModeStrategy,
      **_given_kwargs,
  ):
      """Test wrapper for Ivy frontend functions.
  
      The wrapper sets the required test globals and creates test flags strategies.
  
      Parameters
      ----------
      fn_tree
          Full function import path
      gt_fn_tree
          Full function import path for the ground truth function, by default will be
          the same as fn_tree
      number_positional_args
          A search strategy for determining the number of positional arguments to be
          passed to the function
  
      test_inplace
          A search strategy that generates a boolean to test the method with `inplace`
          update
  
      test_with_out
          A search strategy that generates a boolean to test the function with an `out`
          parameter
  
      test_with_copy
          A search strategy that generates a boolean to test the function with an `copy`
          parameter
  
      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
  
      as_variable_flags
          A search strategy that generates a list of boolean flags for array inputs to be
          passed as a Variable array
  
      native_array_flags
          A search strategy that generates a list of boolean flags for array inputs to be
          passed as a native array
  
      test_trace
          A search strategy that generates a boolean to trace and test the
          function
  
      generate_frontend_arrays
          A search strategy that generates a list of boolean flags for array inputs to
          be frontend array
      """
      fn_tree = f"ivy.functional.frontends.{fn_tree}"
      if aliases is not None:
          for i in range(len(aliases)):
              aliases[i] = f"ivy.functional.frontends.{aliases[i]}"
      is_hypothesis_test = len(_given_kwargs) != 0
  
      if is_hypothesis_test:
          # Use the default strategy
          if number_positional_args is None:
              number_positional_args = num_positional_args(
                  fn_name=fn_tree
              )
          # Generate the test flags strategy
          test_flags = pf.frontend_function_flags(
              num_positional_args=number_positional_args,
              with_out=_get_runtime_flag_value(test_with_out),
              with_copy=_get_runtime_flag_value(test_with_copy),
              inplace=_get_runtime_flag_value(test_inplace),
              as_variable=_get_runtime_flag_value(as_variable_flags),
              native_arrays=_get_runtime_flag_value(native_array_flags),
              test_trace=_get_runtime_flag_value(test_trace),
              generate_frontend_arrays=_get_runtime_flag_value(
                  generate_frontend_arrays
              ),
              transpile=_get_runtime_flag_value(transpile),
              precision_mode=_get_runtime_flag_value(precision_mode),
          )
  
      def test_wrapper(test_fn):
          callable_fn, fn_name, fn_mod = _import_fn(fn_tree)
          supported_device_dtypes = _get_supported_devices_dtypes(
              fn_name, fn_mod
          )
  
          # If a test is not a Hypothesis test, we only set the test global data
          if is_hypothesis_test:
              param_names = inspect.signature(test_fn).parameters.keys()
              # Check if these arguments are being asked for
              possible_arguments = {
                  "test_flags": test_flags,
                  "fn_tree": (
                      st.sampled_from([fn_tree] + aliases)
                      if aliases is not None
                      else st.just(fn_tree)
                  ),
                  "gt_fn_tree": st.just(gt_fn_tree),
              }
              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]
              # Wrap the test with the @given decorator
              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=fn_tree,
              fn_name=fn_name,
              supported_device_dtypes=supported_device_dtypes,
          )
  
          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 12 for calling a global function with example usage: handle_frontend_test() and returns: test_wrapper, wrapped_test