<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def show_fact(term):
 """ Shows a fact stored for a given term, using a case-insensitive search. If a fact has an author, it will be shown. If it has a timestamp, that will also be shown. """

    logger.info('Showing fact %s', term)
    record = db.facts.find_one({'term': term_regex(term)})

    if record is None:
        return None

    # Fix double spacing in older facts
    if record['fact']:
        record['fact'] = record['fact'].replace('  ', ' ')

    # If it isn't authored
    if not record.get('set_by', ''):
        return record['fact']

    if 'set_date' not in record:
        return '{fact} ({set_by})'.format(**record)

    # Otherwise, do normal formatting
    tz = getattr(settings, 'TIMEZONE', 'US/Eastern')
    try:
        timestamp = datetime.fromtimestamp(record['set_date'], tz=pytz.timezone(tz))
    except TypeError:
        timestamp = record['set_date'].replace(tzinfo=pytz.timezone(tz))
    record['fmt_dt'] = datetime.strftime(timestamp, '%m/%d/%Y %I:%M%p')

    return '{fact} ({set_by} on {fmt_dt})'.format(**record)