def METHOD_NAME(demo_image, impaths, distances, input_image, target_pos):
    """ Add top-10 most similar images from the gallery to demo image. """
    for index, impath in enumerate(impaths[:10]):
        image = cv2.imread(impath)
        image = cv2.resize(image, (SIZE, SIZE))
        h_shift = 2 * BORDER + input_image.shape[0] + (SIZE + BORDER) * (index // 5)
        w_shift = BORDER + (index % 5) * (SIZE + BORDER)
        demo_image[h_shift: h_shift + SIZE, w_shift: w_shift + SIZE] = image
        if distances is not None:
            cv2.putText(demo_image, '{}:{}'.format(index, int(distances[index] * 100) / 100),
                        (w_shift - BORDER, h_shift - 5), 1,
                        TEXT_SIZE, BLACK, LWD)
        else:
            cv2.putText(demo_image, '{}'.format(index), (w_shift - BORDER, h_shift - 5), 1,
                        TEXT_SIZE, BLACK, LWD)
        if target_pos == index:
            cv2.rectangle(demo_image, (w_shift, h_shift), (w_shift + SIZE, h_shift + SIZE),
                          GREEN, BORDER // 3)
    return demo_image