<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def export_setting(file_path, qsettings=None):
 """Export InaSAFE's setting to a file. :param file_path: The file to write the exported setting. :type file_path: basestring :param qsettings: A custom QSettings to use. If it's not defined, it will use the default one. :type qsettings: qgis.PyQt.QtCore.QSettings :returns: A dictionary of the exported settings. :rtype: dict """

    inasafe_settings = {}

    if not qsettings:
        qsettings = QSettings()

    qsettings.beginGroup('inasafe')
    all_keys = qsettings.allKeys()
    qsettings.endGroup()

    for key in all_keys:
        inasafe_settings[key] = setting(key, qsettings=qsettings)

    def custom_default(obj):
        if obj is None or (hasattr(obj, 'isNull') and obj.isNull()):
            return ''
        raise TypeError

    with open(file_path, 'w') as json_file:
        json.dump(
            inasafe_settings, json_file, indent=2, default=custom_default)

    return inasafe_settings