code: def piece_type_at(self, square: Square) -> Optional[PieceType]:
          
          mask = BB_SQUARES[square]
  
          if not self.occupied & mask:
              return None  # Early return
          elif self.pawns & mask:
              return PAWN
          elif self.knights & mask:
              return KNIGHT
          elif self.bishops & mask:
              return BISHOP
          elif self.rooks & mask:
              return ROOK
          elif self.queens & mask:
              return QUEEN
          else:
              return KING
docs: Gets the piece type at the given square.