<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_public_key_hex_from_tx( inputs, address ):
 """ Given a list of inputs and the address of one of the inputs, find the public key. This only works for p2pkh scripts. We only really need this for NAMESPACE_REVEAL, but we included it in other transactions' consensus data for legacy reasons that now have to be supported forever :( """


    ret = None
    for inp in inputs:
        input_scriptsig = inp['script']
        input_script_code = virtualchain.btc_script_deserialize(input_scriptsig)
        if len(input_script_code) == 2:
            # signature pubkey
            pubkey_candidate = input_script_code[1]
            pubkey = None
            try:
                pubkey = virtualchain.BitcoinPublicKey(pubkey_candidate)
            except Exception as e:
                traceback.print_exc()
                log.warn("Invalid public key {}".format(pubkey_candidate))
                continue

            if address != pubkey.address():
                continue

            # success!
            return pubkey_candidate

    return None