A referee may be appointed upon the agreement of the parties filed with the clerk, or judge, or entered in the minutes, or upon the motion of a party to a written contract or lease that provides that any controversy arising therefrom shall be heard by a referee if the court finds a reference agreement exists between the parties: (a) To hear and determine any or all of the issues in an action or proceeding, whether of fact or of law, and to report a statement of decision. (b) To ascertain a fact necessary
(a) The court shall appoint as referee or referees the person or persons, not exceeding three, agreed upon by the parties. (b) If the parties do not agree on the selection of the referee or referees, each party shall submit to the court up to three nominees for appointment as referee and the court shall appoint one or more referees, not exceeding three, from among the nominees against whom there is no legal objection. If no nominations are received from any of the parties, the court shall appoint