def _round(ctx, number, num_digits):
    """
    Rounds a number to a specified number of digits
    """
    number = conversions.to_decimal(number, ctx)
    num_digits = conversions.to_integer(num_digits, ctx)

    return decimal_round(number, num_digits, ROUND_HALF_UP)