1from typing import Union
2
3def compat_bytes(s: Union[bytes, str]) -> str:
4    return s.decode('utf-8') if isinstance(s, bytes) else s
5