Deus ex machina (/ˌdeɪəs ɛks ˈmækɪnə, ˈmɑːk-/ DAY-əs ex-MA(H)K-in-ə,[1] Latin: [ˈdɛ.ʊs ɛks ˈmaːkʰɪnaː]; plural: dei ex machina; English "god from the machine")[2][3] is a plot device whereby a seemingly unsolvable problem in a story is suddenly or abruptly resolved by an unexpected and unlikely occurrence.[4][5] Its function is generally to resolve an otherwise irresolvable plot situation, to surprise the audience, to bring the tale to a happy ending or act as a comedic device.[6]