input: Write a function to calculate the maximum hourglass sum in a 6x6 matrix.
  assert hourglass_sum([
      [1, 1, 1, 0, 0, 0],
      [0, 1, 0, 0, 0, 0],
      [1, 1, 1, 0, 0, 0],
      [0, 0, 2, 4, 4, 0],
      [0, 0, 0, 2, 0, 0],
      [0, 0, 1, 2, 4, 0]]) == 19
  assert hourglass_sum([
      [1, 1, 1, 1, 1, 1],
      [1, 1, 1, 1, 1, 1],
      [1, 1, 1, 1, 1, 1],
      [1, 1, 1, 1, 1, 1],
      [1, 1, 1, 1, 1, 1],
      [1, 1, 1, 1, 1, 1]]) == 7
  assert hourglass_sum([
      [-9, -9, -9,  1, 1, 1],
      [ 0, -9,  0,  4, 3, 2],
      [-9, -9, -9,  1, 2, 3],
      [ 0,  0,  8,  6, 6, 0],
      [ 0,  0,  0, -2, 0, 0],
      [ 0,  0,  1,  2, 4, 0]]) == 28
output: def hourglass_sum(matrix):
      max_sum = float('-inf')
      for i in range(4):
          for j in range(4):
              top = matrix[i][j] + matrix[i][j+1] + matrix[i][j+2]
              middle = matrix[i+1][j+1]
              bottom = matrix[i+2][j] + matrix[i+2][j+1] + matrix[i+2][j+2]
              hourglass = top + middle + bottom
              if hourglass > max_sum:
                  max_sum = hourglass
      return max_sum