<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def html_doc(self):
 """Methods docstring, as HTML"""

        if not self.raw_docstring:
            result = ''

        elif settings.MODERNRPC_DOC_FORMAT.lower() in ('rst', 'restructred', 'restructuredtext'):
            from docutils.core import publish_parts
            result = publish_parts(self.raw_docstring, writer_name='html')['body']

        elif settings.MODERNRPC_DOC_FORMAT.lower() in ('md', 'markdown'):
            import markdown
            result = markdown.markdown(self.raw_docstring)

        else:
            result = "<p>{}</p>".format(self.raw_docstring.replace('\n\n', '</p><p>').replace('\n', ' '))

        return result