Anaerobic treatments of chemical wastes