50034. (a) The legislative body of a city, county, or city and county shall not prohibit or otherwise subject to civil or criminal penalties, or remove and impound a motor vehicle by reason of, the act of sleeping or resting in a lawfully parked motor vehicle.

(b) Nothing in this section shall be interpreted to do any of the following:

(1) Prohibit a law enforcement officer from arresting, citing, or otherwise penalizing an occupant of a motor vehicle for any criminal activity or violation of the Vehicle Code.

(2) Exempt an occupant of a motor vehicle from compliance with any state or local law, including those relating to litter, sanitation, alcohol or drug consumption, weapons possession, animal control, or noise control.

(3) Exempt a vehicle owner from compliance with a local ordinance that restricts the use of public streets for vehicle storage.