code: def format_filename(filename, shorten=False):
      
      if shorten:
          filename = os.path.basename(filename)
      return filename_to_ui(filename)
docs: Formats a filename for user display.  The main purpose of this
      function is to ensure that the filename can be displayed at all.  This
      will decode the filename to unicode if necessary in a way that it will
      not fail.  Optionally, it can shorten the filename to not include the
      full path to the filename.
  
      :param filename: formats a filename for UI display.  This will also convert
                       the filename into unicode without failing.
      :param shorten: this optionally shortens the filename to strip of the
                      path that leads up to it.