comefrom: <doocs>0661.Image Smoother_1.py
code: def imageSmoother( img: List[List[int]]) -> List[List[int]]:
      m, n = len(img), len(img[0])
      ans = [[0] * n for _ in range(m)]
      for i in range(m):
          for j in range(n):
              s = cnt = 0
              for x in range(i - 1, i + 2):
                  for y in range(j - 1, j + 2):
                      if 0 <= x < m and 0 <= y < n:
                          cnt += 1
                          s += img[x][y]
              ans[i][j] = s // cnt
      return ans
masked: def sample_funcname ( var_0 : List [ List [ int ] ] ) -> List [ List [ int ] ] :
      var_4 , var_6 = len ( var_0 ) , len ( var_0 [ 0 ] )
      var_9 = [ [ 0 ] * var_6 for var_7 in range ( var_4 ) ]
      for var_10 in range ( var_4 ) :
          for var_11 in range ( var_6 ) :
              var_13 = var_12 = 0
              for var_16 in range ( var_10 - 1 , var_10 + 2 ) :
                  for var_17 in range ( var_11 - 1 , var_11 + 2 ) :
                      if 0 <= var_16 < var_4 and 0 <= var_17 < var_6 :
                          var_12 += 1
                          var_13 += var_0 [ var_16 ] [ var_17 ]
              var_9 [ var_10 ] [ var_11 ] = var_13 // var_12
      return var_9
  