Can a penalty for an early withdrawal of a CD be deducted from the gain of that same CD? What if the loss is greater than the interest earned? Can that be deducted too?

This is not for an IRA. It's just a CD.