def make_bibtex_file(pubs, pid, person_dir='.'):
    "Make a bibtex file given the publications\n\n    Parameters\n    ----------\n    pubs : list of dict\n        The publications\n    pid : str\n        The person id\n    person_dir : str, optional\n        The person's directory\n    "
    if (not HAVE_BIBTEX_PARSER):
        return None
    skip_keys = {'ID', 'ENTRYTYPE', 'author'}
    bibdb = BibDatabase()
    bibwriter = BibTexWriter()
    bibdb.entries = ents = []
    for pub in pubs:
        ent = dict(pub)
        ent['ID'] = ent.pop('_id')
        ent['ENTRYTYPE'] = ent.pop('entrytype')
        for n in ['author', 'editor']:
            if (n in ent):
                ent[n] = ' and '.join(ent[n])
        for key in ent.keys():
            if (key in skip_keys):
                continue
            ent[key] = latex_safe(str(ent[key]))
        ents.append(ent)
    fname = (os.path.join(person_dir, pid) + '.bib')
    with open(fname, 'w', encoding='utf-8') as f:
        f.write(bibwriter.write(bibdb))
    return fname
Make a bibtex file given the publications

Parameters
----------
pubs : list of dict
    The publications
pid : str
    The person id
person_dir : str, optional
    The person's directory
def make_bibtex_file(pubs, pid, person_dir='.'):
    "Make a bibtex file given the publications\n\n    Parameters\n    ----------\n    pubs : list of dict\n        The publications\n    pid : str\n        The person id\n    person_dir : str, optional\n        The person's directory\n    "
    if (not HAVE_BIBTEX_PARSER):
        return None
    skip_keys = {'ID', 'ENTRYTYPE', 'author'}
    bibdb = BibDatabase()
    bibwriter = BibTexWriter()
    bibdb.entries = ents = []
    for pub in pubs:
        ent = dict(pub)
        ent['ID'] = ent.pop('_id')
        ent['ENTRYTYPE'] = ent.pop('entrytype')
        for n in ['author', 'editor']:
            if (n in ent):
                ent[n] = ' and '.join(ent[n])
        for key in ent.keys():
            if (key in skip_keys):
                continue
            ent[key] = latex_safe(str(ent[key]))
        ents.append(ent)
    fname = (os.path.join(person_dir, pid) + '.bib')
    with open(fname, 'w', encoding='utf-8') as f:
        f.write(bibwriter.write(bibdb))
    return fname