def get_sitetree(self, alias):
cache_ = self.cache<EOL>get_cache_entry = cache_.get_entry<EOL>set_cache_entry = cache_.set_entry<EOL>caching_required = False<EOL>if not self.current_app_is_admin():<EOL><INDENT>alias = self.resolve_tree_i18n_alias(alias)<EOL><DEDENT>sitetree = get_cache_entry('<STR_LIT>', alias)<EOL>if not sitetree:<EOL><INDENT>if DYNAMIC_ONLY:<EOL><INDENT>sitetree = []<EOL><DEDENT>else:<EOL><INDENT>sitetree = (<EOL>MODEL_TREE_ITEM_CLASS.objects.<EOL>select_related('<STR_LIT>', '<STR_LIT>').<EOL>prefetch_related('<STR_LIT>').<EOL>filter(tree__alias__exact=alias).<EOL>order_by('<STR_LIT>', '<STR_LIT>'))<EOL><DEDENT>sitetree = self.attach_dynamic_tree_items(alias, sitetree)<EOL>set_cache_entry('<STR_LIT>', alias, sitetree)<EOL>caching_required = True<EOL><DEDENT>parents = get_cache_entry('<STR_LIT>', alias)<EOL>if not parents:<EOL><INDENT>parents = defaultdict(list)<EOL>for item in sitetree:<EOL><INDENT>parent = getattr(item, '<STR_LIT>')<EOL>parents[parent].append(item)<EOL><DEDENT>set_cache_entry('<STR_LIT>', alias, parents)<EOL><DEDENT>if caching_required:<EOL><INDENT>cache_update = cache_.update_entry_value<EOL>for item in sitetree:<EOL><INDENT>cache_update('<STR_LIT>', alias, {item.id: item})<EOL><DEDENT><DEDENT>url = self.url<EOL>calculate_item_depth = self.calculate_item_depth<EOL>for item in sitetree:<EOL><INDENT>if caching_required:<EOL><INDENT>item.has_children = False<EOL>if not hasattr(item, '<STR_LIT>'):<EOL><INDENT>item.depth = calculate_item_depth(alias, item.id)<EOL><DEDENT>item.depth_range = range(item.depth)<EOL>if item.access_restricted:<EOL><INDENT>permissions_src = (<EOL>item.permissions if getattr(item, '<STR_LIT>', False)<EOL>else item.access_permissions.all())<EOL>item.perms = set(<EOL>['<STR_LIT>' % (perm.content_type.app_label, perm.codename) for perm in permissions_src])<EOL><DEDENT><DEDENT>item.url_resolved = url(item)<EOL>item.title_resolved = LazyTitle(item.title) if VARIABLE_TAG_START in item.title else item.title<EOL>item.is_current = False<EOL>item.in_current_branch = False<EOL><DEDENT>self.get_tree_current_item(alias)<EOL>if caching_required:<EOL><INDENT>cache_.save()<EOL><DEDENT>return alias, sitetree<EOL>
Gets site tree items from the given site tree.
        Caches result to dictionary.
        Returns (tree alias, tree items) tuple.

        :param str|unicode alias:
        :rtype: tuple