def _to(f, x, nearest):
    """
    :param f: rounding function, e.g. ceiling, floor, round
    :param x: number to round
    :param nearest: number to round to
    :return: x rounded to `nearest`
    """
    return nearest * f(float(x) / nearest)