Likely catalyzes the NAD(P)-dependent oxidative deamination of (3R)-3-methyl-D-ornithyl-N6-L-lysine, resulting in the formation of pyrrolysine after spontaneous dehydration and cyclization of the intermediate. Is required for the biosynthesis of pyrrolysine. Amino-acid biosynthesis; L-pyrrolysine biosynthesis. Cells lacking this gene are unable to translate UAG as pyrrolysine, and do not produce pyrrolysine. Belongs to the PylD family.