def __generate_doc_string(self, pcg):
    is_constructor = (self.name == '__init__')
    no_doc_elements = not (self.arguments or self.return_type or self.doc)

    if not self.doc_enabled or is_constructor or no_doc_elements:
      return

    pcg.writeln('"""')
    if self.doc:
      doc = self.__format_doc()
      for line in doc.split('\n'):
        pcg.writeln(line)

    if self.arguments:
      if self.doc:
        pcg.writeln()
      pcg.writeln('Args:')
      pcg.indent()
      for arg in self.arguments:
        doc = arg.name
        if arg.data_type:
          doc += ' ' + arg.data_type
        pcg.writeln(doc)
      pcg.dedent()

    if self.return_type:
      if self.doc or self.arguments:
        pcg.writeln()
      pcg.writeln('Returns:')
      pcg.indent()
      pcg.writeln(self.return_type)
      pcg.dedent()
    pcg.writeln('"""')
Checks whether the current method should be given a doc string and
dataset/ETHPy150Open hiranya911/rest-coder/python-lib/codegen_core.py/Method.__generate_doc_string