def from_string(unicode_string):
    """
    Converts the given String to a byte array.

    :param unicode_string: The String to be converted to a byte array.
    :return: A byte array representing the String.
    """
    result = None
    if unicode_string is not None:
        result = bytearray(unicode_string.encode('utf-8'))
    return result
