import inspect


def _do_doc(name, obj, module):
    """Check if object should be documented"""

    # Do not document private objects
    if name.startswith("_"):
        return False

    # Do not document no_doc types
    no_docs = ["datadescriptor", "module", "memberdescriptor", "methoddescriptor", "getsetdescriptor"]
    for no_doc in no_docs:
        isfunc = getattr(inspect, f"is{no_doc}")
        if isfunc(obj):
            return False

    # Only document the current module, not modules imported inside the current module
    if hasattr(obj, "__module__"):
        return obj.__module__ == module.__name__

    return True