code: def max_subarray_sum(a):
      curr_sum = 0
      max_sum = 0
  
      for val in a:
          # extend the current sum with the curren value;
          # reset it to 0 if it is smaller than 0, we care only about non-negative sums
          curr_sum = max(0, curr_sum + val)
  
          # check if this is the max sum
          max_sum = max(max_sum, curr_sum)
  
      return max_sum
  
label_desc: Use image node_id 1 for calling a global function with example usage: max_subarray_sum(a) and returns: max_sum