multi signature – P2SH tackle as a product of public keys

Assuming the multisig 2 of three, if I do have prolonged public keys (xpub) for all 3 cosigners (with correct derivations), can I considerably get the end result tackle (P2SH)? Learn how to calculate the “script” out of those public keys?
Could be cool to have scheme for doing so or a code/pseudocode in python if doable.