I am trying to implement multiprocessing for the below code and seems like nothing is working for me. patterns and output are lists which contain lakhs of elements.