code: def _check_directions(angles):
      """
      Helper function to check if direction ground truth have the right format
      and are in cartesian coordinates
  
      Parameters
      ----------
      angles : array (K,2) or (K, 3)
          List of K polar angles (in degrees) for the sticks or array of K
          sticks as unit vectors.
  
      Returns
      -------
      sticks : (K,3)
          Sticks in cartesian coordinates.
      """
      angles = np.array(angles)
      if angles.shape[-1] == 3:
          sticks = angles
      else:
          sticks = [
              sphere2cart(1, np.deg2rad(pair[0]), np.deg2rad(pair[1]))
              for pair in angles
          ]
          sticks = np.array(sticks)
  
      return sticks
  
imports: import numpy
  from numpy import dot
  from dipy.core.geometry import sphere2cart
  from dipy.core.geometry import vec2vec_rotmat
  from dipy.core.gradients import GradientTable
  from dipy.reconst.utils import dki_design_matrix
  from scipy.special import jn
label_desc: Use image node_id 1 for calling a global function with example usage: _check_directions(angles) and returns: sticks