code: def _get_output(output, input, shape=None, complex_output=False):
      if shape is None:
          shape = input.shape
      if output is None:
          if not complex_output:
              output = numpy.zeros(shape, dtype=input.dtype.name)
          else:
              complex_type = numpy.promote_types(
                  input.dtype, numpy.complex64
              )
              output = numpy.zeros(shape, dtype=complex_type)
      elif isinstance(output, (type, numpy.dtype)):
          # Classes (like `np.float32`) and dtypes are interpreted as dtype
          if complex_output and numpy.dtype(output).kind != "c":
              warnings.warn(
                  "promoting specified output dtype to complex"
              )
              output = numpy.promote_types(output, numpy.complex64)
          output = numpy.zeros(shape, dtype=output)
      elif isinstance(output, str):
          output = numpy.sctypeDict[output]
          if complex_output and numpy.dtype(output).kind != "c":
              raise RuntimeError("output must have complex dtype")
          output = numpy.zeros(shape, dtype=output)
      elif output.shape != shape:
          raise RuntimeError("output shape not correct")
      elif complex_output and output.dtype.kind != "c":
          raise RuntimeError("output must have complex dtype")
      return output
  
imports: from collections.abc import Iterable
  import warnings
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: _get_output(output, input, shape, complex_output) and returns: output