code: def set_number_of_points_python(xyz, n_pols=3):
      def _extrap(xyz, cumlen, distance):
          """Helper function for extrapolate"""
          ind = np.where((cumlen - distance) > 0)[0][0]
          len0 = cumlen[ind - 1]
          len1 = cumlen[ind]
          Ds = distance - len0
          Lambda = Ds / (len1 - len0)
          return Lambda * xyz[ind] + (1 - Lambda) * xyz[ind - 1]
  
      cumlen = np.zeros(xyz.shape[0])
      cumlen[1:] = length_python(xyz, along=True)
      step = cumlen[-1] / (n_pols - 1)
  
      ar = np.arange(0, cumlen[-1], step)
      if np.abs(ar[-1] - cumlen[-1]) < np.finfo("f4").eps:
          ar = ar[:-1]
  
      xyz2 = [_extrap(xyz, cumlen, distance) for distance in ar]
      return np.vstack((np.array(xyz2), xyz[-1]))
  
imports: import warnings
  import types
  import numpy
  from numpy.linalg import norm
  import numpy.testing
  from dipy.testing.memory import get_type_refcount
  from dipy.testing import assert_arrays_equal
  from dipy.testing.decorators import set_random_number_generator
  from dipy.testing import assert_true
  from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_raises, assert_allclose, assert_almost_equal, assert_equal
  from dipy.tracking.streamlinespeed import compress_streamlines, length, set_number_of_points
  from dipy.tracking.streamline import Streamlines
  from dipy.tracking.streamline import relist_streamlines, unlist_streamlines, center_streamlines, transform_streamlines, select_random_set_of_streamlines, select_by_rois, orient_by_rois, orient_by_streamline, values_from_volume, deform_streamlines, cluster_confidence
label_desc: Use image node_id 2 for calling a global function with example usage: set_number_of_points_python(xyz, n_pols) and returns: np, unknown