<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def format_dirname(series_name, season_number):
 """Generates a directory name based on metadata using configured format. :param str series_name: name of TV series :param int season_number: the numeric season of series :returns: formatted directory name using input values and configured format :rtype: str """


    data = {
        'seriesname': _replace_series_name(
            series_name, cfg.CONF.output_series_replacements),
        'seasonnumber': season_number,
    }

    return tc.titlecase(cfg.CONF.directory_name_format % data)