Section 11. Any person retained in a facility under the provisions of paragraph (a) of section ten shall be free to leave such facility at any time, and any parent or guardian who requested the admission of such person may withdraw such person at any time, upon giving written notice to the superintendent. The superintendent may restrict the right to leave or withdraw to normal working hours and weekdays and, in his discretion, may require persons or the parents or guardians of persons to give three days written notice of their intention to leave or withdraw. Where persons or their parents or guardians are required to give three days notice of intention to leave or withdraw, an examination of such persons may be conducted to determine their clinical progress, their suitability for discharge and to investigate other aspects of their case including their legal competency and their family, home or community situation in the interest of discharging them from the facility. Such persons may be retained at the facility beyond the expiration of the three day notice period if, prior to the expiration of the said three day notice period, the superintendent files with the district court a petition for the commitment of such person at the said facility. Before accepting an application for voluntary admission where the superintendent may require three days written notice of intention to leave or withdraw, the admitting or treating physician shall assess the person's capacity to understand that: (i) the person is agreeing to stay or remain at the hospital; (ii) the person is agreeing to accept treatment; (iii) the person is required to provide the facility with three days written advance notice of the person's intention to leave the facility; and (iv) the facility may petition a court for an extended commitment of the person and that he may be held at the facility until the petition is heard by the court. If the physician determines that the person lacks the capacity to understand these facts and consequences of hospitalization, the application shall not be accepted.