def standardize(data, mean, std):
    """Standardize datasets using the given statistics.

    Args:
        data (np.ndarray or list of np.ndarray): Dataset or list of
            datasets to standardize.
        mean (number): Mean statistic.
        std (number): Standard deviation statistic.

    Returns:
        np.ndarray or list of np.ndarray: The standardized dataset(s).
    """
    if isinstance(data, list):
        return [(x - mean) / std for x in data]
    return (data - mean) / std