1. In any prosecution in which the defendant seeks to invoke any of
the defenses specified in section 156.50 of the penal law, the defendant
must within forty-five days after arraignment and not less than twenty
days before the commencement of the trial serve upon the people and file
with the court a written notice of his intention to present such
defense. For good cause shown, the court may extend the period for
service of the notice.
2. The notice served must specify the subdivision or subdivisions upon
which the defendant relies and must also state the reasonable grounds
that led the defendant to believe that he had the authorization required
by the statute or the right required by the statute to engage in such
conduct.
3. If at the trial the defendant seeks to invoke any of the defenses
specified in section 156.50 of the penal law without having served the
notice as required, or seeks to invoke a subdivision or a ground not
specified in the notice, the court may exclude any testimony or evidence
in regard to the defense, or any subdivision or ground, not noticed. The
court may in its discretion, for good cause shown, receive such
testimony or evidence, but before doing so, it may, upon application of
the people, grant an adjournment.