In Pakistan's case, it should be done according to Pakistan's national interests. At any cost, Pakistan should strive to be included in SCO. Iran is a candidate of SCO. Additionally, Iran is Pakistan's next door neighbour and an energy superpower. It is also technologically advanced and self sufficient nation, despite sanctions. Both Pakistan and Iran has same enemies ie. Zionists, who are conspiring to free Balochistan and invade Iran.
Therefore, I believe Pakistan should side with Iran - 70%. 30% of cases Pakistan may offer some diplomatic hogwash and statements for the Arabs just to keep relations intact, who are largely Zionist puppets, directly or indirectly. But real collaboration should be with Iran, China and possibly Russia.