You are a developer working on the Shopping Cart section of an e-commerce website. You've come across some code written by another developer. Take some time to understand what this code is doing.
def calculate_total(prices: dict[str, float], quantities: dict[str, int]) -> float:
total = 0.0
for item in prices:
if item in quantities:
total += prices[item] * quantities[item]
return total Describe the functionality of this code for an AI assistant by focusing on its overall purpose and what it achieves, rather than detailing each line. Emphasize the main function and the rules it follows to accomplish its task.
The AI assistant will generate a new code based on your description. The generated code doesn't need to be identical to the code above, but it should achieve the same outcome.