Give landlord one month notice to leave early or always 1 month penalty?

Of course each contract may be unique, but if one leaves an apartment before the one year contract is up is there always a one month penalty (only getting on of the 2 months of deposit money back) or can one generally get the full 2 months back IF they give the landlord one month of notice?

My experience: I’ve always given at least 30 days notice and I’ve received my full deposit back at all places except one. That one was a real stickler, but it was in the contract. The other landlords appreciated the way I left the apartment so they waived the penalty even though it was in the contract. In the end it was their decision to do so.

Laws as of now are one months notice gets you your full deposit less outstanding expenses such as electricity, water etc.

Do you have a source for this? I need to leave my apartment in 2 months and i’m worried I will lose my full deposit. The contract says that leaving early they will take the deposit

FYI