def check_lnd_channels(stub):
    """let's assume that check_lnd() was called just before calling this"""
    total_active_channels = 0
    total_remote_balance_sat = 0

    try:
        request = ln.ListChannelsRequest(
            active_only=True,
            inactive_only=False,
            public_only=False,
            private_only=False,
        )
        response = stub.ListChannels(request)

        total_active_channels = len(response.channels)
        for channel in response.channels:
            # log.debug(channel)
            total_remote_balance_sat += channel.remote_balance

    except grpc.RpcError as err:
        if err._state.__dict__['code'] == grpc.StatusCode.UNIMPLEMENTED:
            log.debug("wallet is 'locked'")
        else:
            log.warning("an unknown RpcError occurred")
            log.warning(err)

    except Exception as err:
        log.warning("an error occurred: {}".format(err))

    return total_active_channels, total_remote_balance_sat
let's assume that check_lnd() was called just before calling this
home.admin/BlitzTUI/blitztui/client.py