code: def run_example(self, source):
          
          code = compile(source, "<docs>", "exec")
          buffer = []
          invoke = partial(self.invoke, _output_lines=buffer)
  
          def println(text=""):
              buffer.append(text)
  
          exec(
              code,
              self.namespace,
              {
                  "invoke": invoke,
                  "println": println,
                  "isolated_filesystem": self.isolated_filesystem,
              },
          )
          return buffer
docs: Run commands by executing the given code, returning the lines
          of input and output. The code should be a series of the
          following functions:
  
          *   :meth:`invoke`: Invoke a command, adding env vars, input,
              and output to the output.
          *   ``println(text="")``: Add a line of text to the output.
          *   :meth:`isolated_filesystem`: A context manager that changes
              to a temporary directory while executing the block.