<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_row(self, row):
 """ Format the row to fit our export switch the key used to store it in the dict since csv writer is expecting dict with keys matching the headers' names we switch the name the attributes fo the row are stored using labels instead of names """

        res_dict = {}
        headers = getattr(self, 'headers', [])
        extra_headers = getattr(self, 'extra_headers', [])
        for header in tuple(headers) + tuple(extra_headers):
            name, label = header['name'], header['label']
            val = row.get(name)
            if val is None:
                continue
            label = force_encoding(label, self.encoding)
            if hasattr(self, "format_%s" % name):
                val = getattr(self, "format_%s" % name)(val)

            res_dict[label] = force_encoding(val, self.encoding)
        return res_dict