'Build extra user preferences inputs list.
Add values to the fields if present'

def _build_extra_user_pref_inputs(self, preferences, user):

    if (not preferences):
        return []
    data = []
    data_key = 'extra_user_preferences'
    if (data_key in user.preferences):
        data = json.loads(user.preferences[data_key])
    extra_pref_inputs = list()
    for (item, value) in preferences.items():
        if (value is not None):
            for input in value['inputs']:
                input['help'] = ('Required' if input['required'] else '')
                field = ((item + '|') + input['name'])
                for data_item in data:
                    if (field in data_item):
                        input['value'] = data[data_item]
            extra_pref_inputs.append({'type': 'section', 'title': value['description'], 'name': item, 'expanded': True, 'inputs': value['inputs']})
    return extra_pref_inputs
