code: def dtype_factory(kind, sizes, valid_sizes, endianness):
      # Utility function, shared logic for most integer and string types
      valid_endian = ("?", "<", "=", ">")
      check_argument(
          endianness in valid_endian,
          "Unknown endianness: was {}, must be in {}",
          endianness,
          valid_endian,
      )
      if valid_sizes is not None:
          if isinstance(sizes, int):
              sizes = (sizes,)
          check_argument(
              sizes, "Dtype must have at least one possible size."
          )
          check_argument(
              all(s in valid_sizes for s in sizes),
              "Invalid sizes: was {} must be an item or sequence "
              "in {}",
              sizes,
              valid_sizes,
          )
          if all(isinstance(s, int) for s in sizes):
              sizes = sorted({s // 8 for s in sizes})
      strat = st.sampled_from(sizes)
      if "{}" not in kind:
          kind += "{}"
      if endianness == "?":
          return strat.map(("<" + kind).format) | strat.map(
              (">" + kind).format
          )
      return strat.map((endianness + kind).format)
  
imports: from __future__ import absolute_import, division, print_function
  import math
  import re
  from collections import namedtuple
  import numpy
  import hypothesis.internal.conjecture.utils
  import hypothesis.strategies._internal.core
  from hypothesis import Verbosity, assume
  from hypothesis._settings import note_deprecation
  from hypothesis.errors import InvalidArgument
  from hypothesis.internal.compat import PY2, hrange, integer_types, quiet_raise, string_types
  from hypothesis.internal.coverage import check_function
  from hypothesis.internal.reflection import proxies, reserved_means_kwonly_star
  from hypothesis.internal.validation import check_type, check_valid_interval
  from hypothesis.reporting import current_verbosity
  from hypothesis.strategies._internal import SearchStrategy
  from hypothesis.utils.conventions import UniqueIdentifier, not_set
label_desc: Use image node_id 10 for calling a global function with example usage: dtype_factory(kind, sizes, valid_sizes, endianness) and returns: strat, unknown