<｜begin▁of▁sentence｜>### Instruction:
How can you manage a collection of items where each key can have multiple associated values, similar to parameters in a query string or in an HTTP request? Provide an example using the 'multidict' API to add, access, and iterate over items with multiple values for the same key.
### Response:
from multidict import MultiDict

# Initializing the multidict
d = MultiDict([('key1', 'value1'), ('key1', 'value2'), ('key2', 'value3')])

# Adding an item to the multidict
d.add('key2', 'value4')

# Accessing items
element = d['key1']  # Returns the first item associated with 'key1'

# Getting all values associated with a key
values = d.getlist('key1')

# Iterating over the multidict items
for key, values in d.lists():
    print(f'{key}: {values}')

# Output:
# key1: ['value1', 'value2']
# key2: ['value3', 'value4']
<|EOT|>
