def METHOD_NAME(name, class_, docstring=None):
    '''Return a Sphinx .. class:: directive for the given class.
    The directive includes the class's docstring if it has one.
    :param name: the name to give to the class in the directive,
        eg. 'DefaultDatasetForm'
    :type name: string
    :param class_: the class itself
    :type class_: class
    :param docstring: if given, use this instead of introspecting the class
        to find its actual docstring
    :type docstring: string
    :returns: a Sphinx .. class:: directive for the class
    :rtype: string
    '''
    # The template we'll use to render the Sphinx class directive.
    template = ('.. py:class:: ckan.plugins.toolkit.{cls}\n'
                '\n'
                '{docstring}\n'
                '\n')
    docstring = docstring or inspect.getdoc(class_)
    if docstring is None:
        docstring = ''
    else:
        # Indent the docstring by 3 spaces, as needed for the Sphinx directive.
        docstring = '\n'.join(['   ' + line for line in docstring.split('\n')])
    return template.format(cls=name, docstring=docstring)