Getting execution bytecode from trace_addresses

https://ethereum.stackexchange.com/questions/145071/getting-execution-bytecode-from-trace-addresses

Given the following call graph:

A
  CALLs B
    CALLs G
  CALLs C
    CALLs G

Is it possible to get the full bytecode that was executed by the evm as a single string, given the bytecode of the contracts and the parity trace_addresses or do I need more information for that?

Essentially I am trying to do something like this:

def extract_executed_bytecode(trace_addresses, contract_bytecodes):
    # help
    return executed_bytecode
trace_addresses = [
    {'A': []},
    {'B': [0]},
    {'G': [0, 0]},
    {'C': [1]},
    {'G': [1, 0]}
]
contract_bytecodes = {
    'A': '0x6060604052600a8060106000396000f360606040526008565b00',
    'B': '0x6060604052600b8060106000396000f360606040526009565b00',
    'C': '0x6060604052600c8060106000396000f36060604052600a565b00',
    'G': '0x6060604052600d8060106000396000f36060604052600b565b00'
}