def METHOD_NAME(imports: List[ImportModel], delimiter: str) -> str:
    """Serialize a given import type."""
    import_list = []
    for module_name in sorted(set(i.module_name for i in imports)):
        normal_imports = [
            i for i in imports if i.module_name == module_name and not i.version_modules
        ]
        versioned_imports = [
            i for i in imports if i.module_name == module_name and i.version_modules
        ]
        if normal_imports:
            import_list.append(_serialize_package(normal_imports, delimiter))
        for i in versioned_imports:
            import_list.append(_serialize_versioned_package(i, delimiter))
    return delimiter.join(import_list)