def _check_equal_dts(G, H, custom_msg=None):
    """
    A helper function to assert whether the given objects have the same
    sampling periods.
    """
    if not G._dt == H._dt:
        if custom_msg is None:
            custom_msg = "The sampling periods don't match."
        raise ValueError(custom_msg)
