<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_settings(cls, settings, prefix='mail.'):
 """Create a new instance of 'DebugMailer' from settings dict. :param settings: a settings dict-like :param prefix: prefix separating 'tgext.mailer' settings """

        settings = settings or {}
        top_level_directory = settings.get(prefix+'top_level_directory')
        if top_level_directory is None:
            raise ValueError("DebugMailer:  must specify "
                             "'%stop_level_directory'" % prefix)
        return cls(top_level_directory)