docs: def _required_idiom(tag_name, index, notfoundmsg):
      """
      Generate code, which make sure that `tag_name` has enoug items.
  
      Args:
          tag_name (str): Name of the container.
          index (int): Index of the item you want to obtain from container.
          notfoundmsg (str): Raise :class:`.UserWarning` with debug data and
                             following message.
  
      Returns:
          str: Python code.
      """
      cond = ""
      if index > 0:
          cond = " or len(el) - 1 < %d" % index
  
      tag_name = str(tag_name)
  
      output = IND + "if not el%s:\n" % cond
      output += IND + IND + "raise UserWarning(\n"
      output += IND + IND + IND + "%s +\n" % repr(notfoundmsg.strip() + "\n")
      output += IND + IND + IND + repr("Tag name: " + tag_name) + " + '\\n' +\n"
      output += IND + IND + IND + "'El:' + str(el) + '\\n' +\n"
      output += IND + IND + IND + "'Dom:' + str(dom)\n"
      output += IND + IND + ")\n\n"
  
      return output + IND + "el = el[%d]\n\n" % index