Python Imitation Solution
\nclass Solution:\n    def rotateTheBox(self, box: List[List[str]]) -> List[List[str]]:\n        #Columns stores a list of # of stones seperated by obstacles\n 
```\nclass Solution:\n    def rotateTheBox(self, box: List[List[str]]) -> List[List[str]]:\n        #Columns stores a list of # of stones seperated by obstacles\n        columns = collections.defaultdict(list)\n        rows, cols = len(box), len(box[0])\n        obstacles = set()\n        #Saving the number of stones from the bottom up till every obstacle\n        for i in range(rows):\n            stones = 0\n            for j in range(cols - 1, -1, -1):\n                if box[i][j] == \'#\': #if we see a stone\n                    stones += 1\n                elif box[i][j] == \'*\': #if we see an obstacle\n                    columns[rows - i - 1].append(stones)\n                    stones = 0\n                    #Saving the new position of an obstacle\n                    obstacles.add((j, rows - i - 1))\n                    \n            if stones: columns[rows - i - 1].append(stones)\n        \n        res = [[\'.\'] * rows for _ in range(cols)]\n        rows, cols = cols, rows\n        for j in range(cols - 1, -1, -1):\n            obs = 0\n            for i in range(rows - 1, -1, -1):\n                if (i, j) in obstacles:\n                    res[i][j] = \'*\' #mark obstacle\n                    obs += 1 #move to the next region\n                else:\n                    #If we have more stones left for this region\n                    if obs < len(columns[j]) and columns[j][obs]:\n                        res[i][j] = \'#\'\n                        columns[j][obs] -= 1 #decrement # of stones for this region\n        return res\n```
[]