code: def markdown_2_rst(lines):
      
      out = []
      code = False
      for line in lines:
          # code blocks
          if line.strip() == "```":
              code = not code
              space = " " * (len(line.rstrip()) - 3)
              if code:
                  out.append("\n\n%s.. code-block:: none\n\n" % space)
              else:
                  out.append("\n")
          else:
              if code and line.strip():
                  line = "    " + line
              else:
                  # escape any backslashes
                  line = line.replace("\\", "\\\\")
              out.append(line)
      return out
docs: Convert markdown to restructured text