code: def piece_map(self) -> Dict[Square, Piece]:
          
          result = {}
          for square in scan_reversed(self.occupied):
              result[square] = typing.cast(Piece, self.piece_at(square))
          return result
docs: Gets a dictionary of :class:`pieces <chess.Piece>` by square index.