def test_pin_unlocked(func):
    """Function decorator to test the Ledger for being unlocked, and if not,
    raise a human-readable exception.
    """
    def catch_exception(self, *args, **kwargs):
        try:
            return func(self, *args, **kwargs)
        except SecurityStatusNotSatisfiedError:
            raise UserFacingException(_('Your Ledger is locked. Please unlock it.'))
    return catch_exception
Function decorator to test the Ledger for being unlocked, and if not,
    raise a human-readable exception.
    
electrum/plugins/ledger/ledger.py