Branch-models are currently not implemented in godon. In the PAML manual Ziheng Yang writes:
This model is very parameter-rich and its use is discouraged.
This was one of the reasons I did not implement it.
Disclaimer: I am the author of godon.
You need to iterate over the sequence 3 characters at a time and you need to stop when you hit the stop codon (or before for an invalid codon, e.g. of length 2). Here is a memory efficient implementation using iterators (requires python >= 3.8):
from itertools import islice
it = iter(Seq)
lst = 
while codon := "&...