diff --git a/stubs/html5lib/METADATA.toml b/stubs/html5lib/METADATA.toml
index 23a4684130a6..6e34b51f685f 100644
--- a/stubs/html5lib/METADATA.toml
+++ b/stubs/html5lib/METADATA.toml
@@ -1,5 +1,7 @@
version = "1.1.*"
upstream_repository = "https://github.com/html5lib/html5lib-python"
+requires = ["six"]
+
[tool.stubtest]
extras = ["all"]
diff --git a/stubs/html5lib/html5lib/serializer.pyi b/stubs/html5lib/html5lib/serializer.pyi
index e7232e2e1d11..834e2c21a376 100644
--- a/stubs/html5lib/html5lib/serializer.pyi
+++ b/stubs/html5lib/html5lib/serializer.pyi
@@ -1,7 +1,8 @@
from _typeshed import Incomplete
-from collections.abc import Generator
from typing import overload
+from six import text_type
+
k: str
v: str | int
@@ -32,11 +33,11 @@ class HTMLSerializer:
errors: Incomplete
strict: bool
def __init__(self, **kwargs) -> None: ...
- def encode(self, string): ...
- def encodeStrict(self, string): ...
+ def encode(self, string: text_type) -> str: ...
+ def encodeStrict(self, string: text_type) -> str: ...
encoding: Incomplete
- def serialize(self, treewalker, encoding=None) -> Generator[Incomplete]: ...
- def render(self, treewalker, encoding=None): ...
+ def serialize(self, treewalker: str, encoding: str) -> str: ...
+ def render(self, treewalker: str, encoding: str) -> str: ...
def serializeError(self, data: str = "XXX ERROR MESSAGE NEEDED") -> None: ...
class SerializeError(Exception): ...