Synthesis of polyimide from 5,5''-bis(bromomethyl)-2,2':6',2''-terpyridine and investigation of the polymer sorption behavior towards some metal ions.