nodes: 0, module; 1, function_definition; 2, function_name:get_gallery; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, return_statement; 15, identifier:section; 16, string; 17, identifier:sort; 18, string; 19, identifier:window; 20, string; 21, identifier:show_viral; 22, True; 23, identifier:limit; 24, None; 25, comment:"""
          Return a list of gallery albums and gallery images.
  
          :param section: hot | top | user - defaults to hot.
          :param sort: viral | time - defaults to viral.
          :param window: Change the date range of the request if the section is
              "top", day | week | month | year | all, defaults to day.
          :param show_viral: true | false - Show or hide viral images from the
              'user' section. Defaults to true.
          :param limit: The number of items to return.
          """; 26, assignment; 27, assignment; 28, list_comprehension; 29, string_content:hot; 30, string_content:viral; 31, string_content:day; 32, identifier:url; 33, parenthesized_expression; 34, identifier:resp; 35, call; 36, call; 37, for_in_clause; 38, binary_operator:self._base_url + "/3/gallery/{}/{}/{}/{}?showViral="
                 "{}".format(section, sort, window, '{}', show_viral); 39, attribute; 40, argument_list; 41, identifier:_get_album_or_image; 42, argument_list; 43, identifier:thing; 44, identifier:resp; 45, attribute; 46, call; 47, identifier:self; 48, identifier:_send_request; 49, identifier:url; 50, keyword_argument; 51, identifier:thing; 52, identifier:self; 53, identifier:self; 54, identifier:_base_url; 55, attribute; 56, argument_list; 57, identifier:limit; 58, identifier:limit; 59, concatenated_string; 60, identifier:format; 61, identifier:section; 62, identifier:sort; 63, identifier:window; 64, string; 65, identifier:show_viral; 66, string:"/3/gallery/{}/{}/{}/{}?showViral="; 67, string:"{}"; 68, string_content:{}
code: def get_gallery(self, section='hot', sort='viral', window='day',
                      show_viral=True, limit=None):
          """
          Return a list of gallery albums and gallery images.
  
          :param section: hot | top | user - defaults to hot.
          :param sort: viral | time - defaults to viral.
          :param window: Change the date range of the request if the section is
              "top", day | week | month | year | all, defaults to day.
          :param show_viral: true | false - Show or hide viral images from the
              'user' section. Defaults to true.
          :param limit: The number of items to return.
          """
          url = (self._base_url + "/3/gallery/{}/{}/{}/{}?showViral="
                 "{}".format(section, sort, window, '{}', show_viral))
          resp = self._send_request(url, limit=limit)
          return [_get_album_or_image(thing, self) for thing in resp]