Factor out 'borrow_lock'.

Checks for an existing-and-valid lock on the resource.  If found, but
belonging to another user, raises LockError.