def get_docstring(test):
    """
    Return the docstring from a nose test

    :param test: a nose.case.Test instance
    :return: The docstring of the given test,
        with trailing and leading whitespace removed.
    """

    # Sadly, a protected member seems to be the only way to get to the docstring.
    doc = test.test._testMethodDoc
    if doc:
        return doc.strip()