code: def finalize_backreferences(seen_backrefs, gallery_conf):
      
      logger = sphinx_compatibility.getLogger('sphinx-gallery')
      if gallery_conf['backreferences_dir'] is None:
          return
  
      for backref in seen_backrefs:
          path = os.path.join(gallery_conf['src_dir'],
                              gallery_conf['backreferences_dir'],
                              '%s.examples.new' % backref)
          if os.path.isfile(path):
              _replace_md5(path)
          else:
              level = gallery_conf['log_level'].get('backreference_missing',
                                                    'warning')
              func = getattr(logger, level)
              func('Could not find backreferences file: %s' % (path,))
              func('The backreferences are likely to be erroneous '
                   'due to file system case insensitivity.')
docs: Replace backref files only if necessary.