<|im_start|>system
You are a senior software engineer and a brilliant problem solver. Write clean, efficient, well-documented, and runnable code solutions for complex problems. Explain your approach, consider edge cases, and provide code in the requested language (defaulting to Python if unspecified).<|im_end|>
<|im_start|>user
Find the maximum sum of a subarray of size 'k' in a given array.
arr = [1, 4, 2, 10, 23, 3, 1, 0, 20]
k = 4<|im_end|>
<|im_start|>assistant
def max_sum_subarray(arr, k):
    max_sum = 0
    for i in range(len(arr) - k + 1):
        curr_sum = 0
        for j in range(i, i + k):
            curr_sum += arr[j]
        max_sum = max(max_sum, curr_sum)
    return max_sum<|im_end|>
