def METHOD_NAME(
    parsed_document: str,
    model_id: str,
    section_name: str,
    model_info: ModelInfo,
    code_formatter: CodeFormatter,
):
    """
    :param parsed_document: OpenApi parsed document
    :param model_id: instance or shared
    :param section_name: init or instances
    :param model_info: Information to build the model file
    :param code_formatter:
    """
    # Whether or not there are options with default values
    options_with_defaults = len(model_info.defaults_file_lines) > 0
    model_file_lines = parsed_document.splitlines()
    _add_imports(model_file_lines, options_with_defaults, len(model_info.deprecation_data))
    _fix_types(model_file_lines)
    if model_id in model_info.deprecation_data:
        model_file_lines += _define_deprecation_functions(model_id, section_name)
    model_file_lines += _define_validator_functions(model_id, model_info.validator_data, options_with_defaults)
    config_lines = []
    for i, line in enumerate(model_file_lines):
        if line.startswith('    model_config = ConfigDict('):
            config_lines.append(i)
    extra_config_lines = ['        arbitrary_types_allowed=True,']
    for i, line_number in enumerate(config_lines):
        index = line_number + (len(extra_config_lines) * i) + 1
        for line in extra_config_lines:
            model_file_lines.insert(index, line)
        if i == len(config_lines) - 1:
            model_file_lines.insert(index, '        validate_default=True,')
    model_file_lines.append('')
    model_file_contents = '\n'.join(model_file_lines)
    if any(len(line) > 120 for line in model_file_lines):
        model_file_contents = code_formatter.apply_black(model_file_contents)
    return model_file_contents