def get_lock_behaviour(triggers, all_data, lock):
updates = {}<EOL>lock_key = config._forward_aliases.get(Constants.VERSION_LOCK_FIELD)<EOL>if lock:<EOL><INDENT>updates[Constants.VERSION_LOCK_FIELD] = config.VERSION_LOCK_VALUE<EOL><DEDENT>elif (<EOL>triggers<EOL>and lock_key<EOL>and str(all_data.get(lock_key)) == str(config.VERSION_LOCK_VALUE)<EOL>):<EOL><INDENT>triggers.clear()<EOL>updates[Constants.VERSION_LOCK_FIELD] = config.VERSION_UNLOCK_VALUE<EOL><DEDENT>return updates<EOL>
Binary state lock protects from version increments if set