docs: def get_contents_static(self, block_alias, context):
          """Returns contents of a static block."""
  
          if 'request' not in context:
              # No use in further actions as we won't ever know current URL.
              return ''
  
          current_url = context['request'].path
  
          # Resolve current view name to support view names as block URLs.
          try:
              resolver_match = resolve(current_url)
              namespace = ''
              if resolver_match.namespaces:
                  # More than one namespace, really? Hmm.
                  namespace = resolver_match.namespaces[0]
              resolved_view_name = ':%s:%s' % (namespace, resolver_match.url_name)
          except Resolver404:
              resolved_view_name = None
  
          self._cache_init()
  
          cache_entry_name = cache_get_key(block_alias)
  
          siteblocks_static = self._cache_get(cache_entry_name)
          if not siteblocks_static:
              blocks = Block.objects.filter(alias=block_alias, hidden=False).only('url', 'contents')
              siteblocks_static = [defaultdict(list), defaultdict(list)]
              for block in blocks:
                  if block.url == '*':
                      url_re = block.url
                  elif block.url.startswith(':'):
                      url_re = block.url
                      # Normalize URL name to include namespace.
                      if url_re.count(':') == 1:
                          url_re = ':%s' % url_re
                  else:
                      url_re = re.compile(r'%s' % block.url)
  
                  if block.access_guest:
                      siteblocks_static[self.IDX_GUEST][url_re].append(block.contents)
                  elif block.access_loggedin:
                      siteblocks_static[self.IDX_AUTH][url_re].append(block.contents)
                  else:
                      siteblocks_static[self.IDX_GUEST][url_re].append(block.contents)
                      siteblocks_static[self.IDX_AUTH][url_re].append(block.contents)
  
              self._cache_set(cache_entry_name, siteblocks_static)
  
          self._cache_save()
  
          user = getattr(context['request'], 'user', None)
  
          is_authenticated = getattr(user, 'is_authenticated', False)
  
          if not DJANGO_2:
              is_authenticated = is_authenticated()
  
          if is_authenticated:
              lookup_area = siteblocks_static[self.IDX_AUTH]
          else:
              lookup_area = siteblocks_static[self.IDX_GUEST]
  
          static_block_contents = ''
          if '*' in lookup_area:
              static_block_contents = choice(lookup_area['*'])
          elif resolved_view_name in lookup_area:
              static_block_contents = choice(lookup_area[resolved_view_name])
          else:
              for url, contents in lookup_area.items():
                  if url.match(current_url):
                      static_block_contents = choice(contents)
                      break
  
          return static_block_contents