from b58check to hex and back
The second case is a P2SH address. You must supply the version number/magic byte for the address, which is 5 for P2SH.

&gt;&gt;&gt; bitcoin.b58check_to_hex('3BRu7EhouApLkW1EZ64T9o9yMuX5Rexz6f')
'6ad55439d8faab476bbc0f89183ce689f8f6985b'
&gt;&gt;&gt; bitcoin.hex_to_b58check('6ad55439d8faab476bbc0f89183ce689f8f6985b', magicbyte=5)
'3BRu7EhouApLkW1EZ64T9o9yMuX5Rexz6f'


To figure out what the magic byte of an address is, use this:

&gt;&gt;&gt; bitcoin.get_version_byte('3BRu7EhouApLkW1EZ64T9o9yMuX5Rexz6f')
5