code: def getdtype(dtype, a=None, default=None):
      """Function used to simplify argument processing.  If 'dtype' is not
      specified (is None), returns a.dtype; otherwise returns a np.dtype
      object created from the specified dtype argument.  If 'dtype' and 'a'
      are both None, construct a data type out of the 'default' parameter.
      Furthermore, 'dtype' must be in 'allowed' set.
      """
      # TODO is this really what we want?
      if dtype is None:
          try:
              newdtype = a.dtype
          except AttributeError:
              if default is not None:
                  newdtype = np.dtype(default)
              else:
                  raise TypeError("could not interpret data type")
      else:
          newdtype = np.dtype(dtype)
          if newdtype == np.object_:
              warnings.warn(
                  "object dtype is not supported by sparse matrices"
              )
  
      return newdtype
  
imports: from __future__ import division, print_function, absolute_import
  import operator
  import warnings
  import numpy
  from scipy._lib._version import NumpyVersion
label_desc: Use image node_id 6 for calling a global function with example usage: getdtype(dtype, a, default) and returns: newdtype