code: def _from_docstring_rst(doc):
      
  
      def format_fn(line, status):
          """ format function """
  
          if re_from_data.match(line):
              line = re_from_data.sub(r"**\1** ", line)
              status["add_line"] = True
          line = re_from_defaults.sub(r"*\1*", line)
          if status["listing"]:
              # parameters
              if re_from_param.match(line):
                  m = re_from_param.match(line)
                  line = "  - ``{}`` {}".format(m.group(1), m.group(3))
              # status items
              elif re_from_status.match(line):
                  m = re_from_status.match(line)
                  line = "  - ``{}`` {}".format(m.group(1), m.group(3))
              # bullets
              elif re_from_item.match(line):
                  line = re_from_item.sub(r"  -", line)
              # is continuation line
              else:
                  line = " " * 4 + line.lstrip()
          # in .rst format code samples use double backticks vs single ones for
          # .md This converts them.
          line = re_lone_backtick.sub("``", line)
          return line
  
      return _reformat_docstring(doc, format_fn, code_newline="\n")
docs: format from docstring to ReStructured Text