Parse a payload to get back the name and update hash.
    NOTE: bin_payload excludes the leading three bytes.

def parse(bin_payload):
    """
    Parse a payload to get back the name and update hash.
    NOTE: bin_payload excludes the leading three bytes.
    """
    
    if len(bin_payload) != LENGTHS['name_consensus_hash'] + LENGTHS['value_hash']:
        log.error("Invalid update length %s" % len(bin_payload))
        return None 

    name_consensus_hash_bin = bin_payload[:LENGTHS['name_consensus_hash']]
    value_hash_bin = bin_payload[LENGTHS['name_consensus_hash']:]
    
    name_consensus_hash = hexlify( name_consensus_hash_bin )
    value_hash = hexlify( value_hash_bin )
  
    try:
        rc = update_sanity_test( None, name_consensus_hash, value_hash )
        if not rc:
            raise Exception("Invalid update data")
    except Exception, e:
        log.error("Invalid update data")
        return None

    return {
        'opcode': 'NAME_UPDATE',
        'name_consensus_hash': name_consensus_hash,
        'value_hash': value_hash
    }