'returns a create_string_buffer (ctypes)'

def malloc(self, data, size):

    buffer = None
    if (data != 0):
        if ((sys.version_info.major == 3) and isinstance(data, type(''))):
            data = data.encode()
        buffer = self.create_string_buffer(data, size)
    else:
        buffer = self.create_string_buffer(size)
    return buffer
