The Divine Comedy (Italian: Commedia, later christened "Divina" by Giovanni Boccaccio), written by Dante Alighieri between 1308 and his death in 1321, is widely considered the central epic poem of Italian literature, and is seen as one of the greatest works of world literature. The poem's imaginative vision of the Christian afterlife is a culmination of the medieval world-view as it had developed in the Western Church. It helped establish the Tuscan dialect in which it is written as the Italian standard.
The gate of Purgatory is guarded by an angel who uses the point of his sword to draw the letter "P" (signifying peccatum, sin) seven times on Dante's forehead, abjuring him to "wash you those wounds within." The angel uses two keys, gold and silver, to open the gate and warns Dante not to look back, lest he should find himself outside the gate again, symbolizing Dante having to overcome and rise above the hell that he has just left and thusly leaving his sinning ways behind him.
From there, Virgil guides the pilgrim Dante through the seven terraces of Purgatory. These correspond to the seven deadly sins, each terrace purging a particular sin in an appropriate manner. Those in purgatory can leave their circle whenever they like, but essentially there is an honor system where no one leaves until they have corrected the nature within themselves that caused them to commit that sin. Souls can only move upwards and never backwards, since the intent of Purgatory is for souls to ascend towards God in Heaven, and can ascend only during daylight hours, since the light of God is the only true guidance.