def sparseVectorDotProduct(v1, v2):
    """
    Given two sparse vectors |v1| and |v2|, each represented as collections.defaultdict(float), return
    their dot product.
    You might find it useful to use sum() and a list comprehension.
    This function will be useful later for linear classifiers.
    """
    # BEGIN_YOUR_CODE (our solution is 4 lines of code, but don't worry if you deviate from this)
    result = 0
    for k1, val1 in v1.items():
        for k2, val2 in v2.items():
            if k1 == k2:
                result += val1*val2
    return result
    # END_YOUR_CODE