def rounding_filters(filters, w_multiplier):
    """ Calculate and round number of filters based on width multiplier. """
    if not w_multiplier:
        return filters
    divisor = 8
    filters *= w_multiplier
    new_filters = max(divisor, int(filters + divisor / 2) // divisor * divisor)
    if new_filters < 0.9 * filters:  # prevent rounding by more than 10%
        new_filters += divisor
    return int(new_filters)