(2) It shall be unlawful for any person who is a juvenile to knowingly possess— (A) a handgun; or
(B) ammunition that is suitable for use only in a handgun.
(3) This subsection does not apply to— (A) a temporary transfer of a handgun or ammunition to a juvenile or to the possession or use of a handgun or ammunition by a juvenile if the handgun and ammunition are possessed and used by the juvenile—
(i) in the course of employment, in the course of ranching or farming related to activities at the residence of the juvenile (or on property used for ranching or farming at which the juvenile, with the permission of the property owner or lessee, is performing activities related to the operation of the farm or ranch), target practice, hunting, or a course of instruction in the safe and lawful use of a handgun;
(ii) with the prior written consent of the juvenile’s parent or guardian who is not prohibited by Federal, State, or local law from possessing a firearm, except— (I) during transportation by the juvenile of an unloaded handgun in a locked container directly from the place of transfer to a place at which an activity described in clause (i) is to take place and transportation by the juvenile of that handgun, unloaded and in a locked container, directly from the place at which such an activity took place to the transferor; or
(II) with respect to ranching or farming activities as described in clause (i), a juvenile may possess and use a handgun or ammunition with the prior written approval of the juvenile’s parent or legal guardian and at the direction of an adult who is not prohibited by Federal, State or local law from possessing a firearm;
(iii) the juvenile has the prior written consent in the juvenile’s possession at all times when a handgun is in the possession of the juvenile; and
(iv) in accordance with State and local law