def get_time_tracking_ctman(
    filepath,
    profiling_title="Different ways of doing a task",
    solution_title="Solution A",
    quantity_at_which_to_save=10,
    current_time_func=time,
):
    """Return context manager which stores time intervals.

    Returns a function similar to elapsed_time_printed(),
    but instead of printing the time interval, every time
    it is used it stores the interval.

    Once a predefined number of intervals are stored, the
    intervals are saved in a custom .json file using the
    save_intervals() function.

    Parameters
    ==========
    filepath, profiling_title, solution_title (string)
        check save_intervals() function's docstring for a
        description of such parameters.
    quantity_at_which_to_save (integer)
        intervals are saved when reaching this quantity.
    current_time_func (callable)
        used to obtain the value of the current time;
        default is time.time() from standard library,
        which returns the current time in seconds since
        the Epoch.
    """
    ### create a list wherein to store the intervals
    intervals = []

    @contextmanager
    def execution_time_stored():
        """Store execution time of "with block".

        Also triggers the saving of such data when it
        reaches a predefined quantity.
        """
        ### store the start time
        start = current_time_func()

        ### yield so we enter the "with block"
        yield

        ### store difference between current and start time
        intervals.append(current_time_func() - start)

        ### save intervals if the predefined quantity is
        ### reached

        if len(intervals) == quantity_at_which_to_save:

            save_intervals(intervals, filepath, profiling_title, solution_title)

    return execution_time_stored
Return context manager which stores time intervals.

    Returns a function similar to elapsed_time_printed(),
    but instead of printing the time interval, every time
    it is used it stores the interval.

    Once a predefined number of intervals are stored, the
    intervals are saved in a custom .json file using the
    save_intervals() function.

    Parameters
    ==========
    filepath, profiling_title, solution_title (string)
        check save_intervals() function's docstring for a
        description of such parameters.
    quantity_at_which_to_save (integer)
        intervals are saved when reaching this quantity.
    current_time_func (callable)
        used to obtain the value of the current time;
        default is time.time() from standard library,
        which returns the current time in seconds since
        the Epoch.
    
nodezator/ourstdlibs/profileutils.py