<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_needful_files(self):
 """ Returns set of media files associated with models. Those files won't be deleted. """

        needful_files = []
        for model in self.models():
            media_fields = []
            for field in self.model_file_fields(model):
                media_fields.append(field.name)
            if media_fields:
                exclude_options = {media_field: '' for media_field in media_fields}
                model_uploaded_media = model.objects.exclude(**exclude_options).values_list(*media_fields)
                needful_files.extend(model_uploaded_media)
        return set(chain.from_iterable(needful_files))