def get_symbol(record, rectype, fastadelim, genefield):
    if rectype == 'ensembl':
        fields = [x.split(':') for x in record.description.split()]
        sym = [x[1] for x in fields if x[0] == 'gene_symbol' and len(x) == 2]
    elif rectype == 'swiss':
        fields = [x.split('=') for x in record.description.split()]
        sym = [x[1] for x in fields if x[0] == 'GN' and len(x) == 2]
    elif fastadelim and fastadelim in record.description and genefield:
        return record.description.split(fastadelim)[genefield]
    else:
        return 'NA'
    try:
        return sym[0]
    except IndexError:
        return 'NA'