(Python 2) Converts the value to a `str` (raw bytes).
(value)
| 521 | # raised here, and caught below. |
| 522 | |
| 523 | def normalize_for_urlencode(value): |
| 524 | """(Python 2) Converts the value to a `str` (raw bytes).""" |
| 525 | if isinstance(value, unicode): |
| 526 | return value.encode('utf8') |
| 527 | |
| 528 | if isinstance(value, str): |
| 529 | return value |
| 530 | |
| 531 | return normalize_for_urlencode(str(value)) |
| 532 | |
| 533 | except NameError: |
| 534 | def normalize_for_urlencode(value): |