def str_to_bytes(value):
    """
    Converts string to array of bytes

    :param value: string
    :return: array of bytes
    """
    if isinstance(value, (bytes, bytearray, memoryview)):
        return bytes(value)
    return bytes(value, 'utf-8')
