import math


def round_mult(val, multiple, direction='round'):
    """Rounds :val: to the nearest :multiple:. The argument :direction: should be either 'round', 'up', or 'down'."""
    round_func = {'round': round, 'up': math.ceil, 'down': math.floor}
    return round_func[direction](val / multiple) * multiple