<s> import datetime <EOL> import aniso8601 <EOL> def next_run_and_duration_from_8601 ( interval ) : <EOL> gen = aniso8601 . parse_repeating_interval ( interval ) <EOL> start = next ( gen ) <EOL> second = next ( gen ) <EOL> duration = second - start <EOL> now = datetime . datetime . utcnow ( ) <EOL> diff_from_now = now - start <EOL> number_of_iterations = number_of_iterations_in_time ( <EOL> duration , <EOL> diff_from_now ) <EOL> next_run = apply_delta_to_datetime ( <EOL> duration , <EOL> start , <EOL> number_of_iterations + <NUM_LIT:1> ) <EOL> return next_run , duration <EOL> def number_of_iterations_in_time ( duration , time ) : <EOL> """<STR_LIT>""" <EOL> return int ( time . total_seconds ( ) / duration . total_seconds ( ) ) <EOL> def apply_delta_to_datetime ( delta , dt , times ) : <EOL> full_td = delta * times <EOL> final_dt = dt + full_td <EOL> return final_dt </s>
