human
Can you show me a Python code to return str to bytes 2.
assistant
Here is a Python code to return str to bytes 2 and 3

import sys

def str_to_bytes(s):
    """Convert a string to a byte string."""
    return s.encode('utf-8')

# Enter the string
string = "hello"

# Calling the function
print((str_to_bytes(string)))

#Example Output
# b'hello'

#Remember to inspect code for bugs.