def cert_get_bitstrength(cert):
 if hasattr(cert.public_key(), 'key_size'):
  return cert.public_key().key_size
 else:
  return None

def cert_get_bitstrength ( cert ) : if hasattr ( cert . public_key ( ) , 'key_size' ) : return cert . public_key ( ) . key_size else : return None
calculates a certificates public key bit length .