implement the product quantization method with ?1 L 1 distance as the distance function

only this function is given in solution file
def pq(data, P, init_centroids, max_iter):
    pass
please read the attached doc file for exact question and instructions!
doc file is the question
(lx_pq is a slide to help)