(a) No court of this state shall enforce the terms of, or otherwise regard as valid, any contract between a party and an alien unlawfully present in the United States, if the party had direct or constructive knowledge that the alien was unlawfully present in the United States at the time the contract was entered into, and the performance of the contract required the alien to remain unlawfully present in the United States for more than 24 hours after the time the contract was entered into or performance could not reasonably be expected to occur without such remaining.
(b) This section shall not apply to a contract for lodging for one night, a contract for the purchase of food to be consumed by the alien, a contract for medical services, or a contract for transportation of the alien that is intended to facilitate the alien's return to his or her country of origin.
(c) This section shall not apply to a contract authorized by federal law, to a contract entered into prior to May 18, 2012, or to a contract for the appointment or retention of legal counsel in legal matters.
(d) In proceedings of the court, the determination of whether an alien is unlawfully present in the United States shall be made by the federal government, pursuant to 8 U.S.C. § 1373(c). The court shall consider only the federal government's determination when deciding whether an alien is unlawfully present in the United States. The court may take judicial notice of any verification of an individual's immigration status previously provided by the federal government and may request the federal government to provide further automated or testimonial verification.