<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_nan_locs(self, **kwargs):
 """Gets the locations of nans in feature data and returns the coordinates in the matrix """

        if np.issubdtype(self.X.dtype, np.string_) or np.issubdtype(self.X.dtype, np.unicode_):
            mask = np.where( self.X == '' )
            nan_matrix = np.zeros(self.X.shape)
            nan_matrix[mask] = np.nan

        else:
            nan_matrix = self.X.astype(float)

        if self.y is None:
            return np.argwhere(np.isnan(nan_matrix))
        else:
            nan_locs = []
            for target_value in np.unique(self.y):
                indices = np.argwhere(self.y == target_value)
                target_matrix = nan_matrix[indices.flatten()]
                nan_target_locs = np.argwhere(np.isnan(target_matrix))
                nan_locs.append((target_value, nan_target_locs))

            return nan_locs