code: def _get_axis_and_p(draw, kind="valid"):
      p = draw(
          st.sampled_from(
              ["fro", "nuc", 1, 2, -1, -2, float("inf"), -float("inf")]
          )
      )
      if p in ["fro", "nuc"]:
          max_axes_size = 2
          min_axes_size = 2
      else:
          min_axes_size = 1
          max_axes_size = 5
      dtype_x_axis = draw(
          helpers.dtype_values_axis(
              available_dtypes=helpers.get_dtypes(kind),
              min_num_dims=2,
              valid_axis=True,
              min_value=-1e04,
              max_value=1e04,
              min_axes_size=min_axes_size,
              max_axes_size=max_axes_size,
              large_abs_safety_factor=2,
              safety_factor_scale="log",
              force_int_axis=True,
          )
      )
  
      input_dtype, x, axis = dtype_x_axis
      if type(input_dtype[0]) == str:  # noqa: E721
          if "complex" in input_dtype[0]:
              kind = "complex"
          if "float" in input_dtype[0]:
              kind = "float"
      else:
          if input_dtype[0].is_complex_dtype:
              kind = "complex"
          if input_dtype[0].is_float_dtype:
              kind = "float"
  
      dtype = draw(helpers.get_dtypes(kind, full=False))
      dtype = dtype[0]
      if ivy.can_cast(input_dtype[0], dtype):
          dtype = ivy.promote_types(input_dtype[0], dtype)
      else:
          dtype = input_dtype[0]
  
      return p, input_dtype, x, axis, dtype
  
imports: from hypothesis import strategies
  import ivy
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers import handle_frontend_test
  from ivy_tests.test_ivy.test_functional.test_core.test_statistical import _statistical_dtype_values, _get_castable_dtype
  from ivy_tests.test_ivy.test_functional.test_experimental.test_core.test_statistical import _quantile_helper
label_desc: Use image node_id 1 for calling a global function with example usage: _get_axis_and_p(draw, kind) and returns: p,  input_dtype,  x,  axis,  dtype