Removing solid or liquid contaminants from the gas under pumping