To get back to the OP's question, you will certainly want a dongle from us (Wibu-Systems), Aladdin (now part of SafeNet), KeyLok, or some similar product. Each has pros and cons. Our system, for example, has never been cracked and has protections against license violations on VMs.
Prices vary.
I know our product and SafeNet's will allow you to write your app in C++, C#, and probably Python, since they are encrypting your final binary (mostly they don't care how it is created). Some research is needed; all the vendors I listed have free SDKs that provide you with an actual hardware device and the tools you need to test your app.
To roll your own, or to check for the SN of a USB flash drive, will almost certainly be problematic. SNs are easy to crack and fake. Good software-protection devices pack a LOT of thought, development time, and technology into a simple-appearing gadget. You can write your own BIOS or build your own motherboard, too, but why bother?