introduce find_mask function so that I can reuse code for finding AM and pbot masks.
introduce find_mask function so that I can reuse code for finding AM and pbot masks.

dcherian/eddyshelf,dcherian/eddyshelf,dcherian/eddyshelf