parse gbk file

def parse_gbk(gbks):
    """
    parse gbk file
    """
    for gbk in gbks:
        for record in SeqIO.parse(open(gbk), 'genbank'):
            for feature in record.features:
                if feature.type == 'gene':
                    try:
                        locus = feature.qualifiers['locus_tag'][0]
                    except:
                        continue
                if feature.type == 'CDS':
                    try:
                        locus = feature.qualifiers['locus_tag'][0]
                    except:
                        pass
                    start = int(feature.location.start) + int(feature.qualifiers['codon_start'][0])
                    end, strand = int(feature.location.end), feature.location.strand
                    if strand is None:
                        strand = 1
                    else:
                        strand = -1
                    contig = record.id
#                    contig = record.id.rsplit('.', 1)[0]
                    yield contig, [locus, \
                            [start, end, strand], \
                            feature.qualifiers]