parse ORF to gff format

def parse_orf(insertion, gff):
    """
    parse ORF to gff format
    """
    offset = insertion['offset']
    if type(insertion['orf']) is not str:
        return gff
    for orf in parse_fasta(insertion['orf'].split('|')):
        ID = orf[0].split('>')[1].split()[0]
        Start, End, strand = [int(i) for i in orf[0].split(' # ')[1:4]]
        if strand == 1:
            strand = '+'
        else:
            strand = '-'
        GeneStrand = insertion['strand']
        if strand != GeneStrand:
            if strand == '+':
                strand = '-'
            else:
                strand = '+'
            Start, End = End - 2, Start - 2
        Start, End = abs(Start + offset) - 1, abs(End + offset) - 1
        annot = orf[0].split()[1]
        if annot == 'n/a':
            annot = 'unknown'
        gff['#seqname'].append(insertion['ID'])
        gff['source'].append('Prodigal and Pfam')
        gff['feature'].append('CDS')
        gff['start'].append(Start)
        gff['end'].append(End)
        gff['score'].append('.')
        gff['strand'].append(strand)
        gff['frame'].append('.')
        gff['attribute'].append('ID=%s; Name=%s' % (ID, annot))
    return gff