Epitaxial theory of polytypism; observations on the growth of PbI2 crystals