'Return docstrings from magic functions.'

def _magic_docs(self, brief=False, rest=False):

    mman = self.shell.magics_manager
    docs = mman.lsmagic_docs(brief, missing='No    documentation')
    if rest:
        format_string = '**%s%s**::\n\n%s\n\n'
    else:
        format_string = '%s%s:\n%s\n'
    return ''.join(([(format_string % (magic_escapes['line'], fname, indent(dedent(fndoc)))) for (fname, fndoc) in sorted(docs['line'].items())] + [(format_string % (magic_escapes['cell'], fname, indent(dedent(fndoc)))) for (fname, fndoc) in sorted(docs['cell'].items())]))
