Is Harry Potter Kosher?
שלא להחיות מכשפה - שלא נחיה מכשפה אלא נמיתה, שנאמר (שמות כב יז) מכשפה לא תחיה, ולאו דוקא מכשפה, אלא כל מי שעושה כשוף, אלא שדבר ברגיל, שהנשים כשפניות (סנהדרין סז, א) יותר מן האנשים.
To not keep a witch alive: To not keep a witch alive. Rather, we kill her, as it is stated (Exodus 22:17), "You shall not keep a witch alive." And it is not specifically a witch, but rather anyone that does magic. It is just that it stated it according to what is common, as women are more involved with magic than men (Sanhedrin 67a).
המכשף זה העושה מעשה וכו': תנו רבנן מכשפה אחד האיש ואחד האשה א"כ מה ת"ל מכשפה מפני שרוב נשים מצויות בכשפים
The mishna teaches that the case of the warlock is referring to one who performs a real act of sorcery. The Sages taught in a baraita: The verse: “You shall not allow a witch to live” (Exodus 22:17), does not refer only to a female who practices sorcery; both a man and a woman are included. If so, why does verse state “a witch”? This is because most women are familiar with witchcraft.
מכשפה לא תחיה אחד איש ואחד אשה. ר' ישמעאל אומר, נאמר כאן לא תחיה ונאמר להלן לא תחיה. מה להלן בסייף, אף כאן בסייף. רבי עקיבא אומר, נאמר כאן לא תחיה ונאמר להלן (לא תחיה) אם בהמה אם איש לא יחיה (שמות יט), מה להלן בסקילה אף כאן בסקילה. רבי ישמעאל אומר, הריני דן לא תחיה מלא תחיה ואתה (משיבני) מלא תחיה על לא יחיה. (רבי יוסי הגלילי) אומר, נאמר כאן מכשפה לא תחיה, ונאמר כל שוכב עם בהמה מות יומת. וסמכו לומר מה זה בסקילה אף זה בסקילה. רבי יהודה (בן בתירה) אומר, הרי הוא אומר ואיש או אשה כי יהיה בהם אוב או ידעוני. והלא אוב וידעוני בכלל מכשפה היו ולמה יצאו. להקיש אליהם ולומר לך, מה אלו בסקילה אף כל מכשפים בסקילה. עונש שמענו אזהרה מנין, תלמוד לומר לא ימצא בך מעביר בנו ובתו באש קוסם קסמים מעונן ומנחש ומכשף (דברים יח).
(Exodus 22:17) "A witch you shall not allow to live": Both a man and a woman. R. Yishmael says: It is written here "You shall not allow to live," and elsewhere (Devarim 20:16) "You shall not allow to live. Just as there, (the death is) by the sword, so, here, by the sword. R. Akiva says: It is written here "You shall not allow to live," and elsewhere (Exodus 19:13) "Whether beast or man it shall not live." Just as there (the death is) by stoning, so, here, by stoning. R. Yishmael rejoined: I derive "You shall not allow to live" from "You shall not allow to live," and you answer me from "You shall not allow to live" to "it shall not live!" R. Yossi Haglili says: It is written here "A witch you shall not allow to live," and (Ibid. 18) "Whoever lives with a beast shall be put to death." They are juxtaposed to teach that just as the second (is killed) by stoning, so, the first. R. Yehudah says: It is written (Leviticus 20:27) "And a man or a woman, if there be in them an ov or a yidoni" (shall be stoned). Now "ov" and "yidoni" are types of witchcraft. Why were they singled out for special mention? To teach that just as these are (killed) by stoning, so all (types of) witches are (killed) by stoning. We have heard the punishment. Whence do we derive the exhortation? From (Devarim 18:10) "There shall not be found among you one who passes his son or daughter through fire, a diviner, a soothsayer an enchanter or a witch."
Again, she sent him a dish prepared with magic spells, by means of which she hoped to get him into her power. But when the eunuch set it before him, he saw the image of a man handing him a sword together with the dish, and, warned by the vision, he took good care not to taste of the food. A few days later his mistress came to him, and asked him why he had not eaten of what she had sent him. He reproached her, saying, "How couldst thou tell me, I do not come nigh unto the idols, but only unto the Lord? The God of my fathers hath revealed thy iniquity to me through an angel, but that thou mayest know that the malice of the wicked has no power over those who fear God in purity, I shall eat thy food before thine eyes, and the God of my fathers and the angel of Abraham will be with me." The wife of Potiphar fell upon her face at the feet of Joseph, and amid tears she promised not to commit this sin again.

(לא) אַל־תִּפְנ֤וּ אֶל־הָאֹבֹת֙ וְאֶל־הַיִּדְּעֹנִ֔ים אַל־תְּבַקְשׁ֖וּ לְטָמְאָ֣ה בָהֶ֑ם אֲנִ֖י ה' אֱלֹקֵיכֶֽם׃

(31) Do not turn to ghosts and do not inquire of familiar spirits, to be defiled by them: I the LORD am your God.