def testandset(self):
        if not self.locked:
            self.locked = True
            return True
        else:
            return False
examples:
dataset/ETHPy150Open kleientertainment/ds_mod_tools/pkg/win32/Python27/Lib/mutex.py/mutex.testandset--crossover with--dataset/ETHPy150Open digi604/django-smart-selects/smart_selects/db_fields.py/ChainedManyToManyField.__init__