code: def _complex_to_rfft_output(complex_output, output_shape, axis):
      """Convert the complex output from pyfftw to the real output expected
      from :func:`scipy.fftpack.rfft`.
      """
  
      rfft_output = numpy.empty(
          output_shape, dtype=complex_output.real.dtype
      )
      source_slicer = [slice(None)] * complex_output.ndim
      target_slicer = [slice(None)] * complex_output.ndim
  
      # First element
      source_slicer[axis] = slice(0, 1)
      target_slicer[axis] = slice(0, 1)
      rfft_output[tuple(target_slicer)] = complex_output[
          tuple(source_slicer)
      ].real
  
      # Real part
      source_slicer[axis] = slice(1, None)
      target_slicer[axis] = slice(1, None, 2)
      rfft_output[tuple(target_slicer)] = complex_output[
          tuple(source_slicer)
      ].real
  
      # Imaginary part
      if output_shape[axis] % 2 == 0:
          end_val = -1
      else:
          end_val = None
  
      source_slicer[axis] = slice(1, end_val, None)
      target_slicer[axis] = slice(2, None, 2)
      rfft_output[tuple(target_slicer)] = complex_output[
          tuple(source_slicer)
      ].imag
  
      return rfft_output
  
imports: import itertools
  import math
  from numbers import Number
  import operator
  from .None import numpy_fft
  from ..builders._utils import _default_effort, _default_threads, _cook_nd_args
  from ._utils import _Xfftn
  import numpy
  from scipy.fftpack import diff, tilbert, itilbert, hilbert, ihilbert, cs_diff, sc_diff, ss_diff, cc_diff, shift, fftshift, ifftshift, fftfreq, rfftfreq, convolve
  from ..pyfftw import next_fast_len
label_desc: Use image node_id 10 for calling a global function with example usage: _complex_to_rfft_output(complex_output, output_shape, axis) and returns: rfft_output