quality:correction, structural:reformatting, linguistic:paraphrasing, linguistic:translation
Egypt

In Egyptian mythology, Apep or Apophis is a giant serpentine creature who resides in the Duat, the Egyptian Underworld. The Bremner-Rhind papyrus, written around 310 BC, preserves an account of a much older Egyptian tradition that the setting of the sun is caused by Ra descending to the Duat to battle Apep. In some accounts, Apep is as long as the height of eight men with a head made of flint. Thunderstorms and earthquakes were thought to be caused by Apep's roar and solar eclipses were thought to be the result of Apep attacking Ra during the daytime. In some myths, Apep is slain by the god Set. Nehebkau is another giant serpent who guards the Duat and aided Ra in his battle against Apep. Nehebkau was so massive in some stories that the entire earth was believed to rest atop his coils. Denwen is a giant serpent mentioned in the Pyramid Texts whose body was made of fire and who ignited a conflagration that nearly destroyed all the gods of the Egyptian pantheon. He was ultimately defeated by the Pharaoh, a victory which affirmed the Pharaoh's divine right to rule.

The ouroboros was a well-known Egyptian symbol of a serpent swallowing its own tail. The precursor to the ouroboros was the "Many-Faced", a serpent with five heads, who, according to the Amduat, the oldest surviving Book of the Afterlife, was said to coil around the corpse of the sun god Ra protectively. The earliest surviving depiction of a "true" ouroboros comes from the gilded shrines in the tomb of Tutankhamun. In the early centuries AD, the ouroboros was adopted as a symbol by Gnostic Christians and chapter 136 of the Pistis Sophia, an early Gnostic text, describes "a great dragon whose tail is in its mouth". In medieval alchemy, the ouroboros became a typical western dragon with wings, legs, and a tail. A famous image of the dragon gnawing on its tail from the eleventh-century Codex Marcianus was copied in numerous works on alchemy.