The cocoon or pupa (Latin: pupa, 'doll') is one of the life stages of an insect that undergoes metamorphosis.