How are fungi able to withstand periods of cold or drought?

How are fungi able to withstand periods of cold or drought?