write a native python function for lung segmentation.