from io import BytesIO
from typing import TypeVar

from google.protobuf.message import Message

_MessageT = TypeVar("_MessageT", bound=Message)

def serialize(message: Message, deterministic: bool | None = None) -> bytes: ...
def parse(message_class: type[_MessageT], payload: bytes) -> _MessageT: ...
def serialize_length_prefixed(message: Message, output: BytesIO) -> None: ...
def parse_length_prefixed(message_class: type[_MessageT], input_bytes: BytesIO) -> _MessageT: ...
def byte_size(message: Message) -> int: ...
def clear_message(message: Message) -> None: ...
def clear_field(message: Message, field_name: str) -> None: ...
