Create a function in Python that takes three numbers and returns the maximum value.
def max_value(num1, num2, num3):
    max_val = num1
    if num2 > max_val:
        max_val = num2
    if num3 > max_val:
        max_val = num3
    return max_val