code: def format_filename(series_name, season_number,
                      episode_numbers, episode_names,
                      extension):
      
  
      epdata = {
          'seriesname': tc.titlecase(_replace_series_name(
              series_name, cfg.CONF.output_series_replacements) or ''),
          'seasonnumber': season_number,
          'episode': _format_episode_numbers(episode_numbers),
          'episodename': tc.titlecase(_format_episode_name(episode_names)),
          'ext': extension,
      }
  
      value = apply_replacements(
          cfg.CONF.filename_format_ep % epdata,
          cfg.CONF.output_filename_replacements)
  
      return _make_valid_filename(value)
docs: Generates a filename based on metadata using configured format.
  
      :param str series_name: name of TV series
      :param int season_number: the numeric season of series
      :param list(int) episode_numbers: the numeric episode of the series
      :param list(str) episode_names: episode title of the series
      :param str extension: media file extension
      :returns: formatted filename using input values and configured format
      :rtype: str