def weighted_mean(values, counts):
    """Computes the mean of a sequence of numeric values weighted by counts.

    Args:
        values: Sequence of numeric values.

    Returns:
        The weighted mean (floating point).
    """
    datalen = len(values)
    if datalen == 0:
        raise ValueError("Cannot determine the mena of an empty sequence")
    if datalen != len(counts):
        raise ValueError("'values' and 'counts' must be the same length")
    return sum(v * c for v, c in zip(values, counts)) / sum(counts)