def sign_psbt(self, network, psbt):
        """
        RPC call to sign a passed psbt as required

        Parameters
        ----------
        network : str
            Network to which the txn should apply - eg. 'mainnet', 'testnet', etc.

        psbt : bytes
            The psbt formatted as bytes

        Returns
        -------
        bytes
            The psbt, updated with any signatures required from the hw signer
        """
        # Send PSBT message
        params = {'network': network, 'psbt': psbt}
        msgid = str(random.randint(100000, 999999))
        request = self.jade.build_request(msgid, 'sign_psbt', params)
        self.jade.write_request(request)

        # Read replies until we have them all, collate data and return.
        # NOTE: we send 'get_extended_data' messages to request more 'chunks' of the reply data.
        psbt_out = bytearray()
        while True:
            reply = self.jade.read_response()
            self.jade.validate_reply(request, reply)
            psbt_out.extend(self._get_result_or_raise_error(reply))

            if 'seqnum' not in reply or reply['seqnum'] == reply['seqlen']:
                break

            newid = str(random.randint(100000, 999999))
            params = {'origid': msgid,
                      'orig': 'sign_psbt',
                      'seqnum': reply['seqnum'] + 1,
                      'seqlen': reply['seqlen']}
            request = self.jade.build_request(newid, 'get_extended_data', params)
            self.jade.write_request(request)

        return psbt_out

        RPC call to sign a passed psbt as required

        Parameters
        ----------
        network : str
            Network to which the txn should apply - eg. 'mainnet', 'testnet', etc.

        psbt : bytes
            The psbt formatted as bytes

        Returns
        -------
        bytes
            The psbt, updated with any signatures required from the hw signer
        
electrum/plugins/jade/jadepy/jade.py