def METHOD_NAME(
        name: str, object_: Any, docstring: Optional[str] = None) -> str:
    '''Return a Sphinx .. attribute:: directive for the given object.
    The directive includes the object's class's docstring if it has one.
    :param name: the name to give to the object in the directive,
        eg. 'request'
    :type name: string
    :param object_: the object itself
    :type object_: object
    :param docstring: if given, use this instead of introspecting the object
        to find its actual docstring
    :type docstring: string
    :returns: a Sphinx .. attribute:: directive for the object
    :rtype: string
    '''
    # The template we'll use to render the Sphinx attribute directive.
    template = ('.. py:attribute:: ckan.plugins.toolkit.{obj}\n'
                '\n'
                '{docstring}\n'
                '\n')
    docstring = docstring or inspect.getdoc(object_)
    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(obj=name, docstring=docstring)