def public_key_sec(self):
        """Return the public key as sec, or None in case of failure."""
        if self.is_coinbase():
            return None
        opcodes = ScriptTools.opcode_list(self.script)
        if len(opcodes) == 2 and opcodes[0].startswith("[30"):
            # the second opcode is probably the public key as sec
            sec = h2b(opcodes[1][1:-1])
            return sec
        return None
def public_key_sec ( self ) : if self . is_coinbase ( ) : return None opcodes = ScriptTools . opcode_list ( self . script ) if len ( opcodes ) == 2 and opcodes [ 0 ] . startswith ( "[30" ) : sec = h2b ( opcodes [ 1 ] [ 1 : - 1 ] ) return sec return None
Return the public key as sec, or None in case of failure.