Create a Python function that takes in an array of integers and returns the maximum value.
[2,3,5,1]
def max_value(int_arr):
    max_val = int_arr[0]
    for i in int_arr:
        if i > max_val:
            max_val = i
    return max_val