Necessary Evil Meaning

(idiomatic) An unfavorable thing that must be done or accepted, especially because the available alternative courses of action or inaction would be worse.

Example:   Another punishing round of chemo is a necessary evil if Lisa is to have a fighting chance against the cancer.
  My boss is a real piece of work, but my kids make keeping this job a necessary evil.