<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def default(self, obj):
 """Converts an ndarray into a dictionary for efficient serialization. The dict has three keys: - dtype : The datatype of the array as a string. - shape : The shape of the array as a tuple. - __ndarray__ : The data of the array as a list. Parameters obj : :obj:`numpy.ndarray` The ndarray to encode. Returns ------- :obj:`dict` The dictionary serialization of obj. Raises ------ TypeError If obj isn't an ndarray. """

        if isinstance(obj, np.ndarray):
            return dict(__ndarray__=obj.tolist(),
                        dtype=str(obj.dtype),
                        shape=obj.shape)
        # Let the base class default method raise the TypeError
        return _json.JSONEncoder(self, obj)