def translate_codon(codon): """Convert a codon (three nucleotides) to the corresponding protein.""" # Make sure that we have a length three string if not(is_string(codon)): parameter_error("translate_codon", 1, "string", codon) elif len(codon) != 3: parameter_error("translate_codon", 1, "length 3 string", codon) # For convenience, put it into uppercase codon = codon.upper() # Look it up in the table try: return codons[codon] except KeyError: return '*'