code: def _generate_diag_args(draw):
      x_shape = draw(
          helpers.get_shape(
              min_num_dims=1,
              max_num_dims=2,
              min_dim_size=1,
              max_dim_size=5,
          )
      )
  
      flat_x_shape = math.prod(x_shape)
  
      dtype_x = draw(
          helpers.dtype_and_values(
              available_dtypes=helpers.get_dtypes("numeric"),
              shape=x_shape,
              min_value=-1e2,
              max_value=1e2,
          )
      )
  
      offset = draw(helpers.ints(min_value=-5, max_value=5))
  
      dtype = dtype_x[0]
  
      dtype_padding_value = draw(
          helpers.dtype_and_values(
              available_dtypes=dtype,
              max_dim_size=1,
              min_dim_size=1,
              min_num_dims=1,
              max_num_dims=1,
              min_value=-1e2,
              max_value=1e2,
          )
      )
  
      align = draw(
          st.sampled_from(
              ["RIGHT_LEFT", "RIGHT_RIGHT", "LEFT_LEFT", "LEFT_RIGHT"]
          )
      )
  
      if offset < 0:
          num_rows_is_negative = draw(st.booleans())
          if num_rows_is_negative:
              num_rows = -1
              num_cols = draw(
                  st.one_of(
                      st.integers(min_value=-1, max_value=-1),
                      st.integers(min_value=flat_x_shape, max_value=50),
                  )
              )
          else:
              num_rows_is_as_expected = draw(st.booleans())
              if num_rows_is_as_expected:
                  num_rows = flat_x_shape + abs(offset)
                  num_cols = draw(
                      st.one_of(
                          st.integers(min_value=-1, max_value=-1),
                          st.integers(
                              min_value=flat_x_shape, max_value=50
                          ),
                      )
                  )
              else:
                  num_rows = draw(
                      st.integers(
                          min_value=flat_x_shape + abs(offset) + 1,
                          max_value=50,
                      )
                  )
                  num_cols = draw(st.sampled_from([-1, flat_x_shape]))
      if offset > 0:
          num_cols_is_negative = draw(st.booleans())
          if num_cols_is_negative:
              num_cols = -1
              num_rows = draw(
                  st.one_of(
                      st.integers(min_value=-1, max_value=-1),
                      st.integers(min_value=flat_x_shape, max_value=50),
                  )
              )
          else:
              num_cols_is_as_expected = draw(st.booleans())
              if num_cols_is_as_expected:
                  num_cols = flat_x_shape + abs(offset)
                  num_rows = draw(
                      st.one_of(
                          st.integers(min_value=-1, max_value=-1),
                          st.integers(
                              min_value=flat_x_shape, max_value=50
                          ),
                      )
                  )
              else:
                  num_cols = draw(
                      st.integers(
                          min_value=flat_x_shape + abs(offset) + 1,
                          max_value=50,
                      )
                  )
                  num_rows = draw(st.sampled_from([-1, flat_x_shape]))
  
      if offset == 0:
          num_rows_is_negative = draw(st.booleans())
          num_cols_is_negative = draw(st.booleans())
  
          if num_rows_is_negative and num_cols_is_negative:
              num_rows = -1
              num_cols = -1
  
          if num_rows_is_negative:
              num_rows = -1
              num_cols = draw(
                  st.integers(
                      min_value=flat_x_shape + abs(offset), max_value=50
                  )
              )
  
          if num_cols_is_negative:
              num_cols = -1
              num_rows = draw(
                  st.integers(
                      min_value=flat_x_shape + abs(offset), max_value=50
                  )
              )
  
          else:
              num_rows_is_as_expected = draw(st.booleans())
              if num_rows_is_as_expected:
                  num_rows = flat_x_shape
                  num_cols = draw(
                      st.integers(
                          min_value=flat_x_shape + abs(offset),
                          max_value=50,
                      )
                  )
              else:
                  num_cols = flat_x_shape
                  num_rows = draw(
                      st.integers(
                          min_value=flat_x_shape + abs(offset),
                          max_value=50,
                      )
                  )
  
      return (
          dtype_x,
          offset,
          dtype_padding_value,
          align,
          num_rows,
          num_cols,
      )
  
imports: import math
  from hypothesis import strategies
  from hypothesis import assume
  import numpy
  import pytest
  import itertools
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers import handle_test, BackendHandler
  import ivy
label_desc: Use image node_id 2 for calling a global function with example usage: _generate_diag_args(draw) and returns: dtype_x,  offset,  dtype_padding_value,  align,  num_rows,  num_cols