docs: def open_list(ctx, document, par, root, elem):
      """Open list if it is needed and place current element as first member of a list.
  
      :Args:
        - ctx (:class:`Context`): Context object
        - document (:class:`ooxml.doc.Document`): Document object
        - par (:class:`ooxml.doc.Paragraph`): Paragraph element
        - root (Element): lxml element of current location
        - elem (Element): lxml element representing current element we are trying to insert
  
      :Returns:
          lxml element where future content should be placed.
      """
  
      _ls = None
  
      if par.ilvl != ctx.ilvl or par.numid != ctx.numid:
          # start
  
          if ctx.ilvl is not None and (par.ilvl > ctx.ilvl):
              fmt = _get_numbering(document, par.numid, par.ilvl)
  
              if par.ilvl > 0:
                  # get last <li> in <ul>
                  # could be nicer
                  _b = list(root)[-1]
                  _ls = etree.SubElement(_b, _get_numbering_tag(fmt))
                  root = _ls
              else:
                  _ls = etree.SubElement(root, _get_numbering_tag(fmt))
                  root = _ls
  
              fire_hooks(ctx, document, par, _ls, ctx.get_hook(_get_numbering_tag(fmt)))
  
              ctx.in_list.append((par.numid, par.ilvl))
          elif ctx.ilvl is not None and par.ilvl < ctx.ilvl:
              fmt = _get_numbering(document, ctx.numid, ctx.ilvl)
  
              try:
                  while True:
                      numid, ilvl = ctx.in_list[-1]
  
                      if numid == par.numid and ilvl == par.ilvl:
                          break
  
                      root = _get_parent(root)
                      ctx.in_list.pop()
              except:
                  pass
  
  #        if ctx.numid is not None and par.numid > ctx.numid:
  #            if ctx.numid != None:   
          if par.numid > ctx.numid:
              fmt = _get_numbering(document, par.numid, par.ilvl)
              _ls = etree.SubElement(root, _get_numbering_tag(fmt))
              fire_hooks(ctx, document, par, _ls, ctx.get_hook(_get_numbering_tag(fmt)))
  
              ctx.in_list.append((par.numid, par.ilvl))
              root = _ls
                  
      ctx.ilvl = par.ilvl
      ctx.numid = par.numid
  
      _a = etree.SubElement(root, 'li')
      _a.text = elem.text
  
      for a in list(elem):
          _a.append(a)
  
      fire_hooks(ctx, document, par, _a, ctx.get_hook('li'))
  
      return root