import os, subprocess unlock = os.popen('fastboot getvar unlocked 2>&1').read() print(unlock) #if "yes" not in unlock: # print(True)