Add a lock method

For use with https://github.com/appium/appium/pull/3536