docs: def doc_to_lines(self, doc, format_func=None):
          """
          Generator that converts a doc to a sequence of lines.
          :param doc: A dictionary
          :param format_func: customisable formatter defaults to pformat
          :return: a generator yielding a line at a time
          """
          if format_func:
              for l in format_func(doc).splitlines():
                  yield l
          elif self.pretty_print:
              for l in pprint.pformat(doc).splitlines():
                  yield l
          else:
              for l in str(doc).splitlines():
                  yield l