code: def find_and_store_nn(
      iteration, idx, matrix_profile, mp_index, distance_profile
  ):
      if iteration == 0:
          matrix_profile = distance_profile
          mp_index[:] = idx
      else:
          update_pos = distance_profile < matrix_profile
          mp_index[update_pos] = idx
          matrix_profile[update_pos] = distance_profile[update_pos]
  
      idx_min = np.argmin(distance_profile)
      matrix_profile[idx] = distance_profile[idx_min]
      mp_index[idx] = idx_min
      idx_nn = mp_index[idx]
  
      return (matrix_profile, mp_index, idx_nn)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import math
  import time
  import warnings
  import numpy
label_desc: Use image node_id 10 for calling a global function with example usage: find_and_store_nn(iteration, idx, matrix_profile, mp_index, distance_profile) and returns: matrix_profile,  mp_index,  idx_nn