docs: def auto_zip_open(filepath, mode):
      """Convenience function for opening potentially-compressed files."""
      if filepath.endswith('.gz'):
          outfile = gzip.open(filepath, mode)
      elif filepath.endswith('.bz2'):
          outfile = bz2.BZ2File(filepath, mode)
      else:
          outfile = open(filepath, mode)
      return outfile