code: def easy_dtype(
      ndtype, names=None, defaultfmt="f%i", **validationargs
  ):
      """
      Convenience function to create a `np.dtype` object.
  
      The function processes the input `dtype` and matches it with the given
      names.
  
      Parameters
      ----------
      ndtype : var
          Definition of the dtype. Can be any string or dictionary recognized
          by the `np.dtype` function, or a sequence of types.
      names : str or sequence, optional
          Sequence of strings to use as field names for a structured dtype.
          For convenience, `names` can be a string of a comma-separated list
          of names.
      defaultfmt : str, optional
          Format string used to define missing names, such as ``"f%i"``
          (default) or ``"fields_%02i"``.
      validationargs : optional
          A series of optional arguments used to initialize a
          `NameValidator`.
  
      Examples
      --------
      >>> np.lib._iotools.easy_dtype(float)
      dtype('float64')
      >>> np.lib._iotools.easy_dtype("i4, f8")
      dtype([('f0', '<i4'), ('f1', '<f8')])
      >>> np.lib._iotools.easy_dtype("i4, f8", defaultfmt="field_%03i")
      dtype([('field_000', '<i4'), ('field_001', '<f8')])
  
      >>> np.lib._iotools.easy_dtype((int, float, float), names="a,b,c")
      dtype([('a', '<i8'), ('b', '<f8'), ('c', '<f8')])
      >>> np.lib._iotools.easy_dtype(float, names="a,b,c")
      dtype([('a', '<f8'), ('b', '<f8'), ('c', '<f8')])
  
      """
      try:
          ndtype = np.dtype(ndtype)
      except TypeError:
          validate = NameValidator(**validationargs)
          nbfields = len(ndtype)
          if names is None:
              names = [""] * len(ndtype)
          elif isinstance(names, str):
              names = names.split(",")
          names = validate(
              names, nbfields=nbfields, defaultfmt=defaultfmt
          )
          ndtype = np.dtype(dict(formats=ndtype, names=names))
      else:
          # Explicit names
          if names is not None:
              validate = NameValidator(**validationargs)
              if isinstance(names, str):
                  names = names.split(",")
              # Simple dtype: repeat to match the nb of names
              if ndtype.names is None:
                  formats = tuple([ndtype.type] * len(names))
                  names = validate(names, defaultfmt=defaultfmt)
                  ndtype = np.dtype(list(zip(names, formats)))
              # Structured dtype: just validate the names as needed
              else:
                  ndtype.names = validate(
                      names,
                      nbfields=len(ndtype.names),
                      defaultfmt=defaultfmt,
                  )
          # No implicit names
          elif ndtype.names is not None:
              validate = NameValidator(**validationargs)
              # Default initial names : should we change the format ?
              numbered_names = tuple(
                  "f%i" % i for i in range(len(ndtype.names))
              )
              if (ndtype.names == numbered_names) and (
                  defaultfmt != "f%i"
              ):
                  ndtype.names = validate(
                      [""] * len(ndtype.names), defaultfmt=defaultfmt
                  )
              # Explicit initial names : just validate
              else:
                  ndtype.names = validate(
                      ndtype.names, defaultfmt=defaultfmt
                  )
      return ndtype
  
imports: import numpy
  import numpy._core.numeric
  from numpy._utils import asbytes, asunicode
label_desc: Use image node_id 7 for calling a global function with example usage: easy_dtype(ndtype, names, defaultfmt) and returns: ndtype