import ctypes


def bytes_to_ctarray(bytes_, member_type=ctypes.c_byte):
	"""
	Convert a bytes object into a ctypes array.

	:param bytes bytes_: The bytes object to convert.
	:return: The converted byte array.
	"""
	if len(bytes_) % ctypes.sizeof(member_type):
		raise ValueError('sizeof(bytes) is not a multiple of sizeof(member_type)')
	ctarray = (member_type * (len(bytes_) // ctypes.sizeof(member_type)))()
	ctypes.memmove(ctypes.byref(ctarray), bytes_, len(bytes_))
	return ctarray