code: def array_dtypes(
      draw,
      *,
      num_arrays=st.shared(
          nh.ints(min_value=1, max_value=4), key="num_arrays"
      ),
      available_dtypes=get_dtypes("valid"),
      shared_dtype=False,
      array_api_dtypes=False,
  ):
      """Draws a list of data types.
  
      Parameters
      ----------
      draw
          special function that draws data randomly (but is reproducible) from a given
          data-set (ex. list).
      num_arrays
          number of data types to be drawn.
      available_dtypes
          universe of available data types.
      shared_dtype
          if True, all data types in the list are same.
      array_api_dtypes
          if True, use data types that can be promoted with the array_api_promotion
          table.
  
      Returns
      -------
          A strategy that draws a list of data types.
  
      Examples
      --------
      >>> array_dtypes(
      ...     available_dtypes=get_dtypes("numeric"),
      ...     shared_dtype=True,
      ... )
      ['float64']
  
      >>> array_dtypes(
      ...     available_dtypes=get_dtypes("numeric"),
      ...     shared_dtype=True,
      ... )
      ['int8', 'int8']
  
      >>> array_dtypes(
      ...     available_dtypes=get_dtypes("numeric"),
      ...     shared_dtype=True,
      ... )
      ['int32', 'int32', 'int32', 'int32']
  
      >>> array_dtypes(
      ...     num_arrays=5,
      ...     available_dtypes=get_dtypes("valid"),
      ...     shared_dtype=False,
      ... )
      ['int8', 'float64', 'complex64', 'int8', 'bool']
  
      >>> array_dtypes(
      ...     num_arrays=5,
      ...     available_dtypes=get_dtypes("valid"),
      ...     shared_dtype=False,
      ... )
      ['bool', 'complex64', 'bool', 'complex64', 'bool']
  
      >>> array_dtypes(
      ...     num_arrays=5,
      ...     available_dtypes=get_dtypes("valid"),
      ...     shared_dtype=False,
      ... )
      ['float64', 'int8', 'float64', 'int8', 'float64']
      """
      if isinstance(available_dtypes, st._internal.SearchStrategy):
          available_dtypes = draw(available_dtypes)
      if not isinstance(num_arrays, int):
          num_arrays = draw(num_arrays)
      if num_arrays == 1:
          dtypes = draw(
              ah.list_of_size(
                  x=st.sampled_from(available_dtypes),
                  size=1,
              )
          )
      elif shared_dtype:
          dtypes = draw(
              ah.list_of_size(
                  x=st.sampled_from(available_dtypes),
                  size=1,
              )
          )
          dtypes = [dtypes[0] for _ in range(num_arrays)]
      else:
          unwanted_types = set(ivy.all_dtypes).difference(
              set(available_dtypes)
          )
          if array_api_dtypes:
              pairs = ivy.array_api_promotion_table.keys()
          else:
              pairs = ivy.promotion_table.keys()
          # added to avoid complex dtypes from being sampled if they are not available.
          [
              pair
              for pair in pairs
              if all(d in available_dtypes for d in pair)
          ]
          available_dtypes = [
              pair
              for pair in pairs
              if not any(d in pair for d in unwanted_types)
          ]
          dtypes = list(draw(st.sampled_from(available_dtypes)))
          if num_arrays > 2:
              dtypes += [dtypes[i % 2] for i in range(num_arrays - 2)]
      return dtypes
  
file_path: ivy/ivy_tests/test_ivy/helpers/hypothesis_helpers/dtype_helpers.py
imports: import numpy
  from hypothesis import strategies
  from typing import Optional
  import ivy
  from ..pipeline_helper import BackendHandler, get_frontend_config
  from .None import number_helpers
  from .None import array_helpers
  from ..None import globals
  from ..globals import mod_backend
label_desc: Use image node_id 5 for calling a global function with example usage: array_dtypes(draw) and returns: dtypes