def dot(x: dict, y: dict):
    """Returns the dot product of two vectors represented as dicts.

    Parameters
    ----------
    x
    y

    Examples
    --------

    >>> from river import utils

    >>> x = {'x0': 1, 'x1': 2}
    >>> y = {'x1': 21, 'x2': 3}

    >>> utils.math.dot(x, y)
    42

    """

    if len(x) < len(y):
        return sum(xi * y[i] for i, xi in x.items() if i in y)
    return sum(x[i] * yi for i, yi in y.items() if i in x)