code: def safecall(f, name, *args, **kwargs):
      """Call a LAPACK routine, determining lwork automatically and handling
      error return values"""
      lwork = kwargs.get("lwork", None)
      if lwork in (None, -1):
          kwargs["lwork"] = -1
          ret = f(*args, **kwargs)
          kwargs["lwork"] = ret[-2][0].real.astype(numpy.int)
      ret = f(*args, **kwargs)
      if ret[-1] < 0:
          raise ValueError(
              "illegal value in %d-th argument of internal %s"
              % (-ret[-1], name)
          )
      return ret[:-2]
  
file_path: catboost/contrib/python/scipy/py2/scipy/linalg/decomp_qr.py
imports: from __future__ import division, print_function, absolute_import
  import numpy
  from .lapack import get_lapack_funcs
  from .misc import _datacopied
label_desc: Use image node_id 1 for calling a global function with example usage: safecall(f, name) and returns: ret