How to identify a string as being a byte literal?
<p>In Python 3, if I have a string such that:</p>

<pre><code>print(some_str)
</code></pre>

<p>yields something like this:</p>

<pre><code>b'This is the content of my string.\r\n'
</code></pre>

<p>I know it's a byte literal. </p>

<p>Is there a function that can be used to determine if that string is in byte literal format (versus having, say, the Unicode <code>'u'</code> prefix) without first interpreting? Or is there another best practice for handling this? I have a situation wherein getting a byte literal string needs to be dealt with differently than if it's in Unicode. In theory, something like this:</p>

<pre><code>if is_byte_literal(some_str):
    // handle byte literal case
else:
    // handle unicode case
</code></pre>