Use Multi-thread to detect the outlier

def outlierDetection_threaded(samples_x, samples_y_aggregation):
    '''
    Use Multi-thread to detect the outlier
    '''
    outliers = []

    threads_inputs = [[samples_idx, samples_x, samples_y_aggregation]\
                            for samples_idx in range(0, len(samples_x))]
    threads_pool = ThreadPool(min(4, len(threads_inputs)))
    threads_results = threads_pool.map(_outlierDetection_threaded, threads_inputs)
    threads_pool.close()
    threads_pool.join()

    for threads_result in threads_results:
        if threads_result is not None:
            outliers.append(threads_result)
        else:
            print("error here.")

    outliers = None if len(outliers) == 0 else outliers
    return outliers