(value, encoding="utf-8")
| 59 | |
| 60 | |
| 61 | def to_binary(value, encoding="utf-8") -> bytes: |
| 62 | if isinstance(value, bytes): |
| 63 | return value |
| 64 | if isinstance(value, str): |
| 65 | return value.encode(encoding) |
| 66 | return bytes(value) |
| 67 | |
| 68 | |
| 69 | def is_string(value) -> bool: |
no outgoing calls