code: def to_filename(data,
                  mask=DEFAULT_PAPERS_FILENAME_MASK,
                  extra_formatters=None):
      
      # Handle default argument
      if extra_formatters is None:
          extra_formatters = {}
  
      entry = data.entries[0]
      authors = re.split(' and ', entry['author'])
  
      formatters = {
          "journal": "",
          "title": "",
          "year": "",
          "first": "",
          "last": "",
          "authors": "",
          "arxiv_version": ""
      }
  
      formatters["journal"] = entry.get("journal", "")
      formatters["title"] = entry.get("title", "")
      formatters["year"] = entry.get("year", "")
  
      formatters["first"] = authors[0].split(',')[0].strip()
      formatters["last"] = authors[-1].split(',')[0].strip()
      formatters["authors"] = ", ".join([i.split(',')[0].strip()
                                         for i in authors])
  
      for extra_formatter in extra_formatters:
          formatters[extra_formatter] = extra_formatters[extra_formatter](entry)
  
      arxiv_version = ""
      if "eprint" in entry:
          arxiv_version = '-' + entry['eprint'][entry['eprint'].rfind('v'):]
      formatters["arxiv_version"] = arxiv_version
  
      return tools.slugify(mask.format(**formatters))
docs: Convert a bibtex entry to a formatted filename according to a given mask.
  
      .. note ::
  
          Available formatters out of the box are:
              - ``journal``
              - ``title``
              - ``year``
              - ``first`` for the first author
              - ``last`` for the last author
              - ``authors`` for the list of authors
              - ``arxiv_version`` (discarded if no arXiv version in the BibTeX)
  
          Filename is slugified after applying the masks.
  
      :param data: A ``bibtexparser.BibDatabase`` object representing a \
              BibTeX entry, as the one from ``bibtexparser`` output.
      :param mask: A Python format string.
      :param extra_formatters: A dict of format string (in the mask) and \
              associated lambdas to perform the formatting.
  
      :returns: A formatted filename.