Converts Python object to Weld object.

        Args:
            obj: Python object that needs to be converted to Weld format

        Returns:
            Weld formatted object

def encode(self, obj):
        """Converts Python object to Weld object.

        Args:
            obj: Python object that needs to be converted to Weld format

        Returns:
            Weld formatted object
        """
        if isinstance(obj, np.ndarray):
            if obj.ndim == 1 and obj.dtype == 'int16':
                numpy_to_weld = self.utils.numpy_to_weld_int16_arr
            elif obj.ndim == 1 and obj.dtype == 'int32':
                numpy_to_weld = self.utils.numpy_to_weld_int_arr
            elif obj.ndim == 1 and obj.dtype == 'int64':
                numpy_to_weld = self.utils.numpy_to_weld_long_arr
            elif obj.ndim == 1 and obj.dtype == 'float32':
                numpy_to_weld = self.utils.numpy_to_weld_float_arr
            elif obj.ndim == 1 and obj.dtype == 'float64':
                numpy_to_weld = self.utils.numpy_to_weld_double_arr
            elif obj.ndim == 2 and obj.dtype == 'int16':
                numpy_to_weld = self.utils.numpy_to_weld_int16_arr_arr
            elif obj.ndim == 2 and obj.dtype == 'int32':
                numpy_to_weld = self.utils.numpy_to_weld_int_arr_arr
            elif obj.ndim == 2 and obj.dtype == 'int64':
                numpy_to_weld = self.utils.numpy_to_weld_long_arr_arr
            elif obj.ndim == 2 and obj.dtype == 'float32':
                numpy_to_weld = self.utils.numpy_to_weld_float_arr_arr
            elif obj.ndim == 2 and obj.dtype == 'float64':
                numpy_to_weld = self.utils.numpy_to_weld_double_arr_arr
            elif obj.ndim == 2 and obj.dtype == 'bool':
                numpy_to_weld = self.utils.numpy_to_weld_bool_arr_arr
            elif obj.ndim == 1 and obj.dtype == 'bool':
                numpy_to_weld = self.utils.numpy_to_weld_bool_arr
            else:
                numpy_to_weld = self.utils.numpy_to_weld_char_arr_arr
        elif isinstance(obj, str):
            numpy_to_weld = self.utils.numpy_to_weld_char_arr
        else:
            raise Exception("Unable to encode; invalid object type")

        numpy_to_weld.restype = self.py_to_weld_type(obj).ctype_class
        numpy_to_weld.argtypes = [py_object]
        weld_vec = numpy_to_weld(obj)
        return weld_vec