code: def _convert_when(when):
      # Test to see if when has already been converted to ndarray
      # This will happen if one function calls another, for example ppmt
      if isinstance(when, np.ndarray):
          return when
      try:
          return _when_to_num[when]
      except (KeyError, TypeError):
          return [_when_to_num[x] for x in when]
  
imports: from __future__ import division, absolute_import, print_function
  from decimal import Decimal
  import functools
  import numpy
  from numpy.core import overrides
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_when(when) and returns: when, _when_to_num, unknown