from typing import Any
import io
import yaml


def object_to_yaml_stream(obj: Any) -> io.BytesIO:
    """Convert the given object into a YAML byte stream."""
    stream = io.BytesIO()
    yaml.safe_dump(obj, stream=stream, encoding="utf-8")
    stream.seek(0)
    return stream