I wrote a Python program to control a measurement instrument. This program can be transferred to other instruments, but I don't want people to do this without my agreement. I am therefore considering to use some sort of a lock key mechanism, which allows unlocking the software with a key code that is specific to a given instrument. While it's easy to write a bit of code to do this in Python, this code will be visible to anyone and it will therefore be easy to work around it.
Is there a solution for Python to check the key code such that users will not be able (i) to work around it easily by making trivial changes to my code and (ii) to see the code that implements the secret rules to validate the key code?