Canceling / Updating a Temporal Sleep

I have a workflow that I would like to do the following.
I need to schedule a function to run 7 days from the workflow initialization for a user. However, if event A occurs, I need to cancel the sleep and reset the sleep to start from 7 days from that specific event. Additionally if a different event B occurs, I want to be able to schedule the function for N days from event B.
Since in the python-SDK the workflow sleep is asyncio.sleep, how can I implement these resets of the sleep / changes to the sleep duration?

Use workflow.wait_condition:

await workflow.wait_condition(
                    lambda: event_a_received or event_b_received,
                    timeout=timedelta(days=7),
                )

Here is the Updatable Timer Java sample. I don’t think we ported it to Python already.

Thanks, so through using the wait_condition function I would signal the workflow and for any event in the wait condition, it would exit the sleep based on the signal and I would be able to reset or initialize a new wait condition then right?

I would be able to reset or initialize a new wait condition then right?

I don’t think reset is related to this at all. You can call the wait condition again with a new timeout and possibly condition itself.