def METHOD_NAME(key, linter, code, error_type, default):
    linter_styles = persist.settings.get('linters', {}).get(linter, {}).get('styles', [])
    global_styles = persist.settings.get('styles', [])
    for style_definition in linter_styles:
        if any(map(code.startswith, style_definition.get('codes', []))):
            try:
                return style_definition[key]
            except KeyError:
                ...
    for style_definition in linter_styles:
        # For linter_styles, do not auto fill 'types' if the user already
        # provided 'codes'
        default_ = [] if 'codes' in style_definition else [error_type]
        if error_type in style_definition.get('types', default_):
            try:
                return style_definition[key]
            except KeyError:
                ...
    default_styles = get_default_styles()
    for style_definition in chain(global_styles, default_styles):
        if error_type in style_definition.get('types', [error_type]):
            try:
                return style_definition[key]
            except KeyError:
                ...
    return default