def round_to_nearest(value, round_value=1000):
    """Return the value, rounded to nearest round_value (defaults to 1000).

    Args:
        value: Value to be rounded.
        round_value: Number to which the value should be rounded.

    Returns:
        Value rounded to nearest desired integer.
    """
    if round_value < 1:
        ds = str(round_value)
        nd = len(ds) - (ds.find('.') + 1)
        value = value * 10**nd
        round_value = round_value * 10**nd
        value = int(round(float(value) / round_value) * round_value)
        value = float(value) / 10**nd
    else:
        value = int(round(float(value) / round_value) * round_value)

    return value