Please solve the programming task below using a self-contained code snippet in a markdown code block.

You are given an m x n integer matrix grid.
We define an hourglass as a part of the matrix with the following form:

Return the maximum sum of the elements of an hourglass.
Note that an hourglass cannot be rotated and must be entirely contained within the matrix.
 
Please complete the following python code precisely:
```python
class Solution:
    def maxSum(self, grid: List[List[int]]) -> int:
```