<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_name(self):
 """Formats the media file based on enhanced metadata. The actual name of the file and even the name of the directory structure where the file is to be stored. """

        self.formatted_filename = formatter.format_filename(
            self.series_name, self.season_number,
            self.episode_numbers, self.episode_names,
            self.extension)

        self.formatted_dirname = self.location
        if cfg.CONF.move_files_enabled:
            self.formatted_dirname = formatter.format_location(
                self.series_name, self.season_number)

        self.out_location = os.path.join(self.formatted_dirname,
                                         self.formatted_filename)