At the time of filing of a petition for postcertification treatment the court shall advise the person named in the petition of his right to be represented by an attorney and of his right to demand a jury trial. The court shall assist him in finding an attorney, or, if need be, appoint an attorney if the person is unable to obtain counsel. The court shall appoint the public defender or other attorney to represent the person named in the petition if the person is financially unable to provide his own attorney. The attorney shall advise the person of his rights in relation to the proceeding and shall represent him before the court.
Ca. Welf. and Inst. Code § 5302