Template self-assembly of polyiodide networks