What is the meaning of [Hope for the best and prepare for the worst]

We should all be optimistic, but ready at the same time to meet trouble and
difficulties whenever they arise. The proverb can be found back in Roger
L’Estrange‘s _Seneca’s Morals_ (1702)

> While my father was in the hospital after his brain stroke, we hoped for the
best and prepared for the worst.