def _detect_insane_version_51(self) -> int:
        """Returns 0 if file okay,
        error code 1: multisig wallet has old_mpk
        error code 2: multisig wallet has mixed Ypub/Zpub
        """
        assert self.get('seed_version') == 51
        xpub_type = None
        for ks_name in ['x{}/'.format(i) for i in range(1, 16)]:  # having any such field <=> multisig wallet
            ks = self.data.get(ks_name, None)
            if ks is None: continue
            ks_type = ks.get('type')
            if ks_type == "old":
                return 1  # error
            assert ks_type in ("bip32", "hardware"), f"unexpected {ks_type=}"
            xpub = ks.get('xpub') or None
            assert xpub is not None
            assert isinstance(xpub, str)
            if xpub_type is None:  # first iter
                xpub_type = xpub[0:4]
            if xpub[0:4] != xpub_type:
                return 2  # error
        # looks okay
        return 0
Returns 0 if file okay,
        error code 1: multisig wallet has old_mpk
        error code 2: multisig wallet has mixed Ypub/Zpub
        
electrum/wallet_db.py