What is the function of the epiglottis?

What is the function of the epiglottis?