code: def _wrap_result(result, is_complex, shape=None):
      """
      Convert from real to complex and reshape result arrays.
      """
      if is_complex:
          z = _real2complex(result)
      else:
          z = result
      if shape is not None:
          z = z.reshape(shape)
      return z
  
file_path: catboost/contrib/python/scipy/py2/scipy/optimize/_spectral.py
imports: from __future__ import division, absolute_import, print_function
  import collections
  import numpy
  from scipy.optimize import OptimizeResult
  from scipy.optimize.optimize import _check_unknown_options
  from .linesearch import _nonmonotone_line_search_cruz, _nonmonotone_line_search_cheng
label_desc: Use image node_id 3 for calling a global function with example usage: _wrap_result(result, is_complex, shape) and returns: z