Implement RemoteBranch.lock_write/unlock as smart operations.
Because Branch.lock_write/unlock actually also lock/unlock the repository, I've
slightly changed lock_write's interface to accept and return 'tokens' rather
than 'token'. i.e. a 2-tuple of (branch token, repo token), or None.