## 1 Introduction  
Rapid increases in industrialization for the production of various products such as medicine, cloth, leather, paints, cement, and fertilizers are necessary to fulfill the basic needs of people in the modern world [1; 2; 3; 4]. The effluents coming from these industries include several types of dyes and heavy metals. Mostly these effluents are added into nearby streams, canals, and rivers without any treatment. One of the very toxic elements in these effluents is chromium. It exists in various oxidation states such as Cr(II), Cr(III), Cr(IV), Cr(V), and Cr(VI) but trivalent Cr(III) and hexavalent Cr(VI) are environmentally stable [5]. Hexavalent chromium (Cr(VI)) is about 500 to 1000 times more toxic than its trivalent form, i.e., Cr(III), because of its high solubility and high mobility in almost the whole pH range of its solution [6]. Among toxic pollutants, Cr(VI) has been listed as a priority by the U.S. Environmental Protection Agency (EPA) [7]. It exists as oxyanions (CrO\({}_{4}\)\({}^{-}\), Cr\({}_{2}\)O\({}_{7}\)\({}^{-}\), HCrO\({}_{4}\)\({}^{-}\)) in aqueous environments, and diffuses through cell membranes into living tissues and oxidize biological molecules. Accumulation of Cr(VI) in living tissues even in a very small concentration may cause severe neurological or physiological damage. The maximum permissible concentration of Cr(VI) in water is about 0.05 mg\(\cdot\)L\({}^{-1}\) as accepted by the World Health Organization (WHO) [8]. Perforation of the eardrums and the nasal septum, skin lesions, ulceration, lung cancer, and a decrease in spermatogenesis are the most common effects caused by hexavalent chromium [9]. Nickel is also considered a significant heavy metal and is the fifth most abundant element in the Earth's crust after oxygen, magnesium, silicon, and iron. It is used in various industries such as stainless steel, automotive, hydrogenated oils, fertilizers like super phosphates, and food products [10]. Although it resists air, water, and alkali corrosion, it dissolves easily in dilute mineral acids. It can exist in several oxidation states such as -1, +1, +2, +3, and +4 but the most prominent oxidation state of nickel is +2. Although nickel is not toxic in low concentrations, it becomes harmful to both animals and human beings at high concentrations [11]. The World Health Organization (WHO) has recommended the maximum permissible value of nickel in drinking water as 0.02 mg\(\cdot\)L\({}^{-1}\)[12]. Among various adverse effects of nickel-containing compounds are allergies like contact dermatitis, cardiovascular diseases, respiratory tract cancer, kidney diseases, and lung fibrosis [13]. The presence of both hexavalent chromium Cr(VI) and divalent nickel Ni(II) in water even in very low concentrations contaminates it and makes it unsafe for drinking. Therefore, removal of these heavy metals is very important to make water safe. Several techniques such as flocculation, precipitation, ozonation, chemical coagulation, reverse osmosis, electro dialysis, and adsorption are used to remove heavy metals from aqueous environments [14; 15; 16; 17; 18; 19]. However, among these techniques, adsorption is the most effective because of economic feasibility, its high efficiency, and simplicity of design. Moreover, adsorbents used for the removal of pollutants can be regenerated through desorption [20]. A number of adsorbents such activated carbon, rice husk, clay, sand, and saw dust can be used to remove these heavy metals from aqueous environments [21; 22; 23]. In the last few years, some conducting polymers like polythiophene (PT), polypyrrol (PPY), polyacrylonitrile (PAN), and polyaniline (PANI) have been used as adsorbents for removal of heavy metals and dyes from aqueous solutions [24; 25; 26]. Among conducting polymers, PANI has been used much more frequently because of its easy synthesis from low cost material and has proven to be much friendlier to environment.