refactor getpm25.py and move duplicate table extraction code into a function