<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_fact(term, fact, author=''):
 """ Records a new fact with a given term. Optionally can set an author """

    logger.info('Adding new fact %s: %s', term, fact)

    if not db.facts.find({'term': term_regex(term)}).count():
        db.facts.insert({
            'term': term,
            'fact': fact,
            'set_by': author,
            'set_date': time.time()
        })
        db.facts.ensure_index('term')