def orfs(dna,frame=0) :
    """
    This function outputs a list of all ORFs found in string 'dna', using
    triplet boundaries defined by frame position 'frame'

    dna is the dna sequence to be analysed
    frame is the offset (0,1 or 2) from start of the sequence to scan triplets
    """
    orfs=[]
    orf=''
    start_codons=['atg']
    stop_codons=['tga','tag','taa']
    start_codon_active = False
    for i in range(frame, len(dna),3):
        codon=dna[i:i+3].lower()
        if start_codon_active == False and codon in start_codons :
            start_codon_active = True
        if start_codon_active and codon in stop_codons :
            orfs.append(orf+codon)
            orf=''
            start_codon_active = False
        else:
            if start_codon_active:
                orf=orf+codon
    return orfs