The petition shall be heard in open court, and the respondent to the petition shall have the privilege of counsel of his or her own selection.