import inspect


def get_doc(obj):
    """
        Get the docstring of an object. This differs from the inspect equivalent
        in that it will not attempt to find a doc on parent classes or such, only
        returning the immediate docstring.
    :param obj: Object to get docstring from
    :return: Docstring for the object, if it exists
    """
    try:
        doc = obj.__doc__
    except AttributeError:
        return None
    if not isinstance(doc, str):
        return None
    return inspect.cleandoc(doc)