code: def get_context(self, context):
          
          # forward pass
          i = 0
          while i < len(self.tagList):
              tag = self.tagList[i]
  
              # skip application stuff
              if tag.tagClass == Tag.applicationTagClass:
                  pass
  
              # check for context encoded atomic value
              elif tag.tagClass == Tag.contextTagClass:
                  if tag.tagNumber == context:
                      return tag
  
              # check for context encoded group
              elif tag.tagClass == Tag.openingTagClass:
                  keeper = tag.tagNumber == context
                  rslt = []
                  i += 1
                  lvl = 0
                  while i < len(self.tagList):
                      tag = self.tagList[i]
                      if tag.tagClass == Tag.openingTagClass:
                          lvl += 1
                      elif tag.tagClass == Tag.closingTagClass:
                          lvl -= 1
                          if lvl < 0: break
  
                      rslt.append(tag)
                      i += 1
  
                  # make sure everything balances
                  if lvl >= 0:
                      raise InvalidTag("mismatched open/close tags")
  
                  # get everything we need?
                  if keeper:
                      return TagList(rslt)
              else:
                  raise InvalidTag("unexpected tag")
  
              # try the next tag
              i += 1
  
          # nothing found
          return None
docs: Return a tag or a list of tags context encoded.