Section 1950.5 is the whole California law of residential security deposits, and almost every argument about a deposit is an argument about one of its four moving parts. First, the cap: subdivision (c) says a landlord may not demand or receive security worth more than one month's rent on top of the first month, with a two-month ceiling for a small landlord who is a natural person or an LLC of natural persons owning no more than two rental properties totalling four units. Second, the label does not matter. Subdivision (b) defines "security" as any payment, fee, deposit or charge "however denominated", so calling something a non-refundable cleaning fee or a move-in fee does not take it outside the section.
Third, and this is the provision most deposit disputes turn on, subdivision (e) lists what may be claimed and then removes several familiar deductions from the list. The landlord may only claim amounts "reasonably necessary" for unpaid rent, for damage beyond ordinary wear and tear, for cleaning needed to return the unit to the level of cleanliness it had at the start, and for certain restoration of personal property. Subdivision (e)(2) then says expressly that a landlord shall not claim for conditions that pre-existed the tenancy, for ordinary wear and tear or its effects — including wear accumulated over several tenancies — and shall not require the tenant to pay for professional carpet or other professional cleaning unless it is reasonably necessary to restore the unit to its condition at the start.
Fourth, the clock and the paperwork. Subdivision (h) gives the landlord 21 calendar days after the tenant vacates to send an itemized statement of what was taken and why, together with the remainder of the money; where a deduction exceeds a threshold the statement has to be backed with receipts or invoices. Subdivision (f) gives the tenant the right to ask for an initial inspection up to two weeks before moving out and to be told, in writing, of deficiencies in time to fix them. Subdivision (g) requires the landlord to photograph the unit before and after. Subdivision (m) makes a bad faith retention exposed to statutory damages of up to twice the deposit on top of actual damages. Whether a particular charge is wear and tear or damage, and whether a retention was in bad faith, are questions of fact about your unit and your paperwork — worth discussing with a lawyer or a local tenant service before you write the demand letter.