code: def diag_indices_from(arr):
      """
      Return the indices to access the main diagonal of an n-dimensional array.
  
      See `diag_indices` for full details.
  
      Parameters
      ----------
      arr : array, at least 2-D
  
      See Also
      --------
      diag_indices
  
      Notes
      -----
      .. versionadded:: 1.4.0
  
      """
  
      if not arr.ndim >= 2:
          raise ValueError("input array must be at least 2-d")
      # For more than d=2, the strided formula is only valid for arrays with
      # all dimensions equal, so we check first.
      if not alltrue(diff(arr.shape) == 0):
          raise ValueError(
              "All dimensions of input must be of equal length"
          )
  
      return diag_indices(arr.shape[0], arr.ndim)
  
imports: from __future__ import division, absolute_import, print_function
  import functools
  import sys
  import math
  import numpy.core.numeric
  from numpy.core.numeric import asarray, ScalarType, array, alltrue, cumprod, arange, ndim
  from numpy.core.numerictypes import find_common_type, issubdtype
  import numpy.matrixlib
  from .function_base import diff
  from numpy.core.multiarray import ravel_multi_index, unravel_index
  from numpy.core.overrides import set_module
  from numpy.core import overrides, linspace
  from numpy.lib.stride_tricks import as_strided
label_desc: Use image node_id 7 for calling a global function with example usage: diag_indices_from(arr) and returns: diag_indices