<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_EQUALTIMESTEPS(value, restriction):
 """ Ensure that the timesteps in a timeseries are equal. If a restriction is provided, they must be equal to the specified restriction. Value is a pandas dataframe. """

    if len(value) == 0:
        return

    if type(value) == pd.DataFrame:
        if str(value.index[0]).startswith('9999'):
            tmp_val = value.to_json().replace('9999', '1900')
            value = pd.read_json(tmp_val)


    #If the timeseries is not datetime-based, check for a consistent timestep
    if type(value.index) == pd.Int64Index:
        timesteps = list(value.index)
        timestep = timesteps[1] - timesteps[0]
        for i, t in enumerate(timesteps[1:]):
            if timesteps[i] - timesteps[i-1] != timestep:
                raise ValidationError("Timesteps not equal: %s"%(list(value.index)))


    if not hasattr(value.index, 'inferred_freq'):
        raise ValidationError("Timesteps not equal: %s"%(list(value.index),))

    if restriction is None:
        if value.index.inferred_freq is None:
            raise ValidationError("Timesteps not equal: %s"%(list(value.index),))
    else:
        if value.index.inferred_freq != restriction:
            raise ValidationError("Timesteps not equal: %s"%(list(value.index),))