<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ended(self):
 """We call this method when the function is finished."""

        self._end_time = time.time()

        if setting(key='memory_profile', expected_type=bool):
            self._end_memory = get_free_memory()