def get_bcaddress_version(strAddress):
 addr = b58decode(strAddress, 25)
 if (addr is None):
  return None
 version = addr[0]
 checksum = addr[(-4):]
 vh160 = addr[:(-4)]
 h3 = sha256(sha256(vh160).digest()).digest()
 if (h3[0:4] == checksum):
  return ord(version)
 return None

def get_bcaddress_version ( strAddress ) : addr = b58decode ( strAddress , 25 ) if ( addr is None ) : return None version = addr [ 0 ] checksum = addr [ ( - 4 ) : ] vh160 = addr [ : ( - 4 ) ] h3 = sha256 ( sha256 ( vh160 ) . digest ( ) ) . digest ( ) if ( h3 [ 0 : 4 ] == checksum ) : return ord ( version ) return None
returns none if straddress is invalid .