nodes: 0, module; 1, function_definition; 2, function_name:get_allposts; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, try_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, expression_statement; 14, return_statement; 15, string; 16, assignment; 17, block; 18, except_clause; 19, assignment; 20, assignment; 21, assignment; 22, identifier:j; 23, call; 24, block; 25, assignment; 26, identifier:newlist; 27, string_content:Return all posts in blog sorted by date; 28, identifier:result; 29, call; 30, expression_statement; 31, block; 32, identifier:delta; 33, binary_operator:(total_posts / 10) + 1; 34, identifier:all_posts; 35, list; 36, identifier:posts_ids; 37, list; 38, identifier:range; 39, argument_list; 40, expression_statement; 41, expression_statement; 42, expression_statement; 43, if_statement; 44, for_statement; 45, identifier:newlist; 46, call; 47, attribute; 48, argument_list; 49, assignment; 50, raise_statement; 51, parenthesized_expression; 52, integer:1; 53, identifier:delta; 54, assignment; 55, assignment; 56, assignment; 57, not_operator; 58, block; 59, identifier:i; 60, identifier:posts; 61, block; 62, identifier:sorted; 63, argument_list; 64, attribute; 65, identifier:posts; 66, attribute; 67, keyword_argument; 68, keyword_argument; 69, identifier:total_posts; 70, subscript; 71, call; 72, binary_operator:total_posts / 10; 73, identifier:start; 74, binary_operator:j * 10; 75, identifier:end; 76, binary_operator:(j + 1) * 10; 77, identifier:posts; 78, subscript; 79, call; 80, break_statement; 81, if_statement; 82, expression_statement; 83, expression_statement; 84, expression_statement; 85, expression_statement; 86, expression_statement; 87, expression_statement; 88, expression_statement; 89, expression_statement; 90, expression_statement; 91, expression_statement; 92, expression_statement; 93, expression_statement; 94, identifier:all_posts; 95, keyword_argument; 96, identifier:self; 97, identifier:client; 98, identifier:self; 99, identifier:blog; 100, identifier:offset; 101, integer:0; 102, identifier:limit; 103, integer:1; 104, identifier:result; 105, string; 106, attribute; 107, argument_list; 108, identifier:total_posts; 109, integer:10; 110, identifier:j; 111, integer:10; 112, parenthesized_expression; 113, integer:10; 114, call; 115, string; 116, identifier:len; 117, argument_list; 118, comparison_operator:i['id'] in posts_ids; 119, block; 120, assignment; 121, assignment; 122, assignment; 123, assignment; 124, assignment; 125, assignment; 126, assignment; 127, assignment; 128, assignment; 129, assignment; 130, call; 131, call; 132, identifier:key; 133, lambda; 134, string_content:total_posts; 135, identifier:phasetumblr_errors; 136, identifier:TumblrBlogException; 137, subscript; 138, binary_operator:j + 1; 139, attribute; 140, argument_list; 141, string_content:posts; 142, identifier:posts; 143, subscript; 144, identifier:posts_ids; 145, continue_statement; 146, identifier:description; 147, call; 148, identifier:body; 149, call; 150, identifier:post; 151, dictionary; 152, subscript; 153, subscript; 154, subscript; 155, subscript; 156, subscript; 157, call; 158, subscript; 159, subscript; 160, subscript; 161, subscript; 162, subscript; 163, identifier:body; 164, subscript; 165, identifier:description; 166, attribute; 167, argument_list; 168, attribute; 169, argument_list; 170, lambda_parameters; 171, subscript; 172, subscript; 173, string; 174, identifier:j; 175, integer:1; 176, attribute; 177, identifier:posts; 178, attribute; 179, keyword_argument; 180, keyword_argument; 181, identifier:i; 182, string; 183, identifier:split_body; 184, argument_list; 185, identifier:split_body; 186, argument_list; 187, identifier:post; 188, string; 189, identifier:i; 190, string; 191, identifier:post; 192, string; 193, identifier:i; 194, string; 195, identifier:post; 196, string; 197, attribute; 198, argument_list; 199, identifier:post; 200, string; 201, identifier:i; 202, string; 203, identifier:post; 204, string; 205, identifier:i; 206, string; 207, identifier:post; 208, string; 209, identifier:post; 210, string; 211, identifier:all_posts; 212, identifier:append; 213, identifier:post; 214, identifier:posts_ids; 215, identifier:append; 216, subscript; 217, identifier:k; 218, identifier:k; 219, string; 220, identifier:result; 221, string; 222, string_content:msg; 223, identifier:self; 224, identifier:client; 225, identifier:self; 226, identifier:blog; 227, identifier:offset; 228, identifier:start; 229, identifier:limit; 230, identifier:end; 231, string_content:id; 232, subscript; 233, subscript; 234, integer:1; 235, string_content:title; 236, string_content:title; 237, string_content:link; 238, string_content:post_url; 239, string_content:date; 240, identifier:datetime; 241, identifier:strptime; 242, subscript; 243, string; 244, string_content:tags; 245, string_content:tags; 246, string_content:id; 247, string_content:id; 248, string_content:body; 249, string_content:description; 250, identifier:i; 251, string; 252, string_content:date; 253, string_content:meta; 254, identifier:i; 255, string; 256, identifier:i; 257, string; 258, identifier:i; 259, string; 260, string_content:%Y-%m-%d %H:%M:%S %Z; 261, string_content:id; 262, string_content:body; 263, string_content:body; 264, string_content:date
code: def get_allposts(self):
  		''' Return all posts in blog sorted by date
  		'''
  		result = self.client.posts(self.blog, offset = 0, limit = 1)
  		try: 
  			total_posts = result['total_posts']
  		except:
  			raise phasetumblr_errors.TumblrBlogException(result['meta']['msg'])
  
  		delta = (total_posts / 10) + 1
  
  		all_posts = []
  		posts_ids = []
  		for j in range(delta):
  			start = j * 10
  			end = (j + 1) * 10
  			posts = self.client.posts(self.blog, offset = start, limit = end)['posts']
  			if not len(posts):
  				break
  			for i in posts:
  				if i['id'] in posts_ids:
  					continue
  				description = split_body(i['body'])
  				body = split_body(i['body'], 1)
  				post = {}
  				post['title'] = i['title']
  				post['link'] = i['post_url']
  				post['date'] = datetime.strptime(i['date'], '%Y-%m-%d %H:%M:%S %Z')
  				post['tags'] = i['tags']
  				post['id'] = i['id']
  				post['body'] = body
  				post['description'] = description
  				all_posts.append(post)
  				posts_ids.append(i['id'])
  
  		newlist = sorted(all_posts, key=lambda k: k['date']) 
  		return newlist