python dict to kwargs

func(**{'type':'Event'})

# ^ is equivalent to v

func(type='Event')

Here is what the above code is Doing:
1. We are creating a function named func that takes a variable number of keyword arguments.
2. We are using ** to unpack the keyword arguments into a dictionary named kwargs.
3. We are printing the value of kwargs.
4. We are calling func with the keyword arguments type=’Event’ and isCancelled=True.
5. We are calling func with the keyword arguments **{‘type’:’Event’}
6. We are calling func with the keyword arguments type=’Event’

The output of the code is as follows:
{‘type’: ‘Event’, ‘isCancelled’: True}
{‘type’: ‘Event’}
{‘type’: ‘Event’}

As you can see, the ** operator allows us to unpack a dictionary of keyword arguments into a function call.

You can also use the * operator to unpack a list or tuple of positional arguments into a function call. For example: