Involved in the biosynthesis of pyridine alkaloid natural products, leading mainly to the production of anabasine, anatabine, nicotine and nornicotine, effective deterrents against herbivores with antiparasitic and pesticide properties (neurotoxins); nornicotine serves as the precursor in the synthesis of the carcinogen compound N'-nitrosonornicotine (NNN) (PubMed:17102129). Catalyzes the demethylation of nicotine to form nornicotine (PubMed:17102129). (S)-nicotine + O2 + reduced [NADPH--hemoprotein reductase] = (S)-nornicotine + formaldehyde + H(+) + H2O + oxidized [NADPH--hemoprotein reductase] Alkaloid biosynthesis; nicotine biosynthesis. Expressed in leaves. Expressed in green leaves but fades out during senescence. Belongs to the cytochrome P450 family. CYP82E2 subfamily.