def standard_x(x_train, x_test=None):
    """
    Data normalization (centering and variance normalization).

    :param x_train: training data
    :type x_train: np.ndarray
    :param x_test: testing data
    :type x_test: np.ndarray | None
    :return: normalized data
    :rtype: np.ndarray | (np.ndarray, np.ndarray)
    """
    x_mean = x_train.mean(axis=0)
    x_std = x_train.std(axis=0)
    x_train1 = ((x_train - x_mean) / x_std).values
    if x_test is not None:
        x_test1 = ((x_test - x_mean) / x_std).values
        return x_train1, x_test1
    return x_train1