Deus Ex Machina is basically when some convoluted event occurs where people are saved from an impossible situation. Something like the Sword of Gyffindor appearing from a magical hat that Harry uses to kill the Basilisk. Followed by another Deus Ex Machina where he then gets poisoned by basilisk's venom and is SAVED BY A PHOENIX WITH MAGIC TEARS.