When is eyelid surgery medically necessary?

When is eyelid surgery medically necessary?