def round_to(x, base=1, prec=2):
    """
    Round to nearest base with precision.

    :param x: (scalar) - value to be rounded from
    :param base: (scalar) - value to be rounded to
    :param prec: (int) - number of decimal points
    :return rounded_val: (scalar) - rounded value
    """
    try:
        return round(base * round(float(x) / base), prec)
    except:
        print('Unable to round to')
        return x