def round_partial(value, resolution):
    """Rounds a number to a partial interval. Good for rounding things
       up/down to the nearest value of 5 for example.

       Thanks to http://stackoverflow.com/a/8118808 for this neat trick
    """
    return round(value / resolution) * resolution