docs: def interpolate_motor_positions(self, input_key, nearest_keys):
          """ Process linear interpolation to estimate actual speed and position of motors
              Method specific to the :meth:~pypot.primitive.move.Move.position() structure
              it is a KDTreeDict[timestamp] = {dict[motor]=(position,speed)}
          """
  
          # TODO : to be rewrited with more style (map ?)
  
          if len(nearest_keys) == 1:
              return self[nearest_keys[0]]
          elif len(nearest_keys) == 0:
              raise KeyError('key {} exceed distance_upper_bound {}'.format(
                  input_key, self.distance_upper_bound))
          elif len(nearest_keys) != 2:
              raise NotImplementedError("interpolation works only for k_neighbors = 2")
          elif nearest_keys[0] == nearest_keys[1]:
              # Bug from nearest key ?
              return self[nearest_keys[0]]
  
          # Problem if ValueError: A value in x_new is above the interpolation range.
          elif input_key < min(nearest_keys):
              return self[min(nearest_keys)]
          elif input_key > max(nearest_keys):
              return self[max(nearest_keys)]
  
          interpolated_positions = {}
          for (k, v), (k2, v2) in zip(self[nearest_keys[0]].items(), self[nearest_keys[1]].items()):
              if k == k2:
                  x = np.array(nearest_keys)
                  y_pos = np.array([v[0], v2[0]])
                  y_speed = np.array([v[1], v2[1]])
                  f_pos = interp1d(x, y_pos, bounds_error=False)
                  f_speed = interp1d(x, y_speed, bounds_error=False)
                  # print k, input_key, (float(f_pos(input_key[0])), float(f_speed(input_key[0])))
                  interpolated_positions[k] = (f_pos(input_key), f_speed(input_key))
              else:
                  raise IndexError("key are not identics. Motor added during the record ?")
          return interpolated_positions