<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_callback(callback):
 """ validates a callback's on_loop_start and on_loop_end methods Parameters callback : Callback object Returns ------- validated callback """

    if not(hasattr(callback, '_validated')) or callback._validated == False:
        assert hasattr(callback, 'on_loop_start') \
               or hasattr(callback, 'on_loop_end'), \
               'callback must have `on_loop_start` or `on_loop_end` method'
        if hasattr(callback, 'on_loop_start'):
            setattr(callback, 'on_loop_start',
                    validate_callback_data(callback.on_loop_start))
        if hasattr(callback, 'on_loop_end'):
            setattr(callback, 'on_loop_end',
                    validate_callback_data(callback.on_loop_end))
        setattr(callback, '_validated', True)
    return callback