docs: def get_context(self, template):
          """Get the context for a template.
  
          If no matching value is found, an empty context is returned.
          Otherwise, this returns either the matching value if the value is
          dictionary-like or the dictionary returned by calling it with
          *template* if the value is a function.
  
          If several matching values are found, the resulting dictionaries will
          be merged before being returned if mergecontexts is True. Otherwise,
          only the first matching value is returned.
  
          :param template: the template to get the context for
          """
          context = {}
          for regex, context_generator in self.contexts:
              if re.match(regex, template.name):
                  if inspect.isfunction(context_generator):
                      if _has_argument(context_generator):
                          context.update(context_generator(template))
                      else:
                          context.update(context_generator())
                  else:
                      context.update(context_generator)
  
                  if not self.mergecontexts:
                      break
          return context