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
  
      Examples
      --------
  
      Create a 4 by 4 array.
  
      >>> a = np.arange(16).reshape(4, 4)
      >>> a
      array([[ 0,  1,  2,  3],
             [ 4,  5,  6,  7],
             [ 8,  9, 10, 11],
             [12, 13, 14, 15]])
  
      Get the indices of the diagonal elements.
  
      >>> di = np.diag_indices_from(a)
      >>> di
      (array([0, 1, 2, 3]), array([0, 1, 2, 3]))
  
      >>> a[di]
      array([ 0,  5, 10, 15])
  
      This is simply syntactic sugar for diag_indices.
  
      >>> np.diag_indices(a.shape[0])
      (array([0, 1, 2, 3]), array([0, 1, 2, 3]))
  
      """
  
      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 np.all(diff(arr.shape) == 0):
          raise ValueError(
              "All dimensions of input must be of equal length"
          )
  
      return diag_indices(arr.shape[0], arr.ndim)
  
imports: import functools
  import sys
  import math
  import warnings
  import numpy
  from .._utils import set_module
  import numpy.core.numeric
  from numpy.core.numeric import ScalarType, array
  from numpy.core.numerictypes import issubdtype
  import numpy.matrixlib
  from .function_base import diff
  from numpy.core.multiarray import ravel_multi_index, unravel_index
  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