Unlock card with SCardEndTransaction.

def unlock(self):
        '''Unlock card with SCardEndTransaction.'''
        component = self.component
        while True:
            if isinstance(
                    component,
                    smartcard.pcsc.PCSCCardConnection.PCSCCardConnection):
                hresult = SCardEndTransaction(component.hcard,
                                              SCARD_LEAVE_CARD)
                if 0 != hresult:
                    raise CardConnectionException(
                        'Failed to unlock with SCardEndTransaction: ' +
                        SCardGetErrorMessage(hresult))
                else:
                    # print('unlocked')
                    pass
                break
            if hasattr(component, 'component'):
                component = component.component
            else:
                break