Discuss the provisions for wrongful confinement as per Indian Penal Code (IPC 1860) Section 340: Wrongful confinement and their relevant Bharatiya Nyaya Sanhita 2023 (BNS 2023) code reference.Explain the punishment for wrongful restraint as per Indian Penal Code (IPC 1860) Section 341: Punishment for wrongful restraint and their relevant Bharatiya Nyaya Sanhita 2023 (BNS 2023) code reference.

{'IPC Section': '340', 'IPC Heading': 'Wrongful confinement', 'IPC Descriptions': ' Indian Penal Code, 1860 
340. Wrongful confinement 
Whoever wrongfully restrains any person in such a manner as to
prevent that person from proceedings beyond certain circumscribing limits, is
said "wrongfully to confine" that person.
Illustrations
(a) A causes Z to go within a walled space, and locks Z in. A is
thus prevented from proceeding in any direction beyond the circumscribing line
of wall. A wrongfully confines Z.
(b) A places men with firearms at the outlets of a building, and
tells Z that they will fire at Z if Z attempts to leave the building. A
wrongfully confines Z.', 'BNS Section': '127', 'BNS Heading': 'Wrongful confinement', 'BNS description': 'The Bharatiya Nyaya Sanhita, 2023
127. Wrongful confinement.
(1) Whoever wrongfully restrains any person in such a manner as to prevent that person from proceedings beyond certain circumscribing limits, is said "wrongfully to confine" that person. Illustrations.
(a) A causes Z to go within a walled space, and locks Z in. Z is thus prevented from proceeding in any direction beyond the circumscribing line of wall. A wrongfully confines Z.
(b) A places men with firearms at the outlets of a building, and tells Z that they will fire at Z if Z attempts to leave the building. A wrongfully confines Z.
(2) Whoever wrongfully confines any person shall be punished with imprisonment of either description for a term which may extend to one year, or with fine which may extend to five thousand rupees, or with both.
(3) Whoever wrongfully confines any person for three days, or more, shall be punished with imprisonment of either description for a term which may extend to three years, or with fine which may extend to ten thousand rupees, or with both.
(4) Whoever wrongfully confines any person for ten days or more, shall be punished with imprisonment of either description for a term which may extend to five years, and shall also be liable to fine which shall not be less than ten thousand rupees.
(5) Whoever keeps any person in wrongful confinement, knowing that a writ for the liberation of that person has been duly issued, shall be punished with imprisonment of either description for a term which may extend to two years in addition to any term of imprisonment to which he may be liable under any other section of this Chapter and shall also be liable to fine.
(6) Whoever wrongfully confines any person in such manner as to indicate an intention that the confinement of such person may not be known to any person interested in the person so confined, or to any public servant, or that the place of such confinement may not be known to or discovered by any such person or public servant as hereinbefore mentioned, shall be punished with imprisonment of either description for a term which may extend to three years in addition to any other punishment to which he may be liable for such wrongful confinement and shall also be liable to fine.
(7) Whoever wrongfully confines any person for the purpose of extorting from the person confined, or from any person interested in the person confined, any property or valuable security or of constraining the person confined or any person interested in such person to do anything illegal or to give any information which may facilitate the commission of an offence, shall be punished with imprisonment of either description for a term which may extend to three years, and shall also be liable to fine.
(8) Whoever wrongfully confines any person for the purpose of extorting from the person confined or any person interested in the person confined any confession or any information which may lead to the detection of an offence or misconduct, or for the purpose of constraining the person confined or any person interested in the person confined to restore or to cause the restoration of any property or valuable security or to satisfy any claim or demand, or to give information which may lead to the restoration of any property or valuable security, shall be punished with imprisonment of either description for a term which may extend to three years, and shall also be liable to fine.'}