def build_genome(tree, genome):
    """
    Goes through a tree and builds a genome from all codons in the subtree.

    :param tree: An individual's derivation tree.
    :param genome: The list of all codons in a subtree.
    :return: The fully built genome of a subtree.
    """
    
    if tree.codon:
        # If the current node has a codon, append it to the genome.
        genome.append(tree.codon)
    
    for child in tree.children:
        # Recurse on all children.
        genome = child.build_genome(genome)
    
    return genome