Document a module

    Parameters
    ----------
    module_name : str
    module : module
    output_dir : str
    source_location : str
    leaf : bool

def doc_module(module_name, module, output_dir, source_location, leaf):
    """
    Document a module

    Parameters
    ----------
    module_name : str
    module : module
    output_dir : str
    source_location : str
    leaf : bool
    """
    path = pathlib.Path(output_dir).joinpath(*module.__name__.split("."))
    available_classes = get_available_classes(module)
    deffed_classes = get_classes(module)
    deffed_funcs = get_funcs(module)
    deffed_enums = get_enums(module)
    alias_funcs = available_classes - deffed_classes
    if leaf:
        doc_path = path.with_suffix(".md")
    else:
        doc_path = path / "index.md"
    doc_path.parent.mkdir(parents=True, exist_ok=True)
    module_path = "/".join(module.__name__.split("."))
    doc = [f"title: {module_name.split('.')[-1]}" + "\n"]
    module_doc = module.__doc__

    # Module overview documentation
    if module_doc is not None:
        doc += to_doc(module.__name__, module, 1, source_location)
    else:
        doc.append(f"# {module.__name__}\n\n")
    doc.append("\n\n")
    for cls_name, cls in sorted(deffed_enums) + sorted(deffed_classes):
        doc += to_doc(cls_name, cls, 2, source_location)

        class_methods = [
            x
            for x in inspect.getmembers(cls, inspect.isfunction)
            if (not x[0].startswith("_")) and deffed_here(x[1], cls)
        ]
        class_methods += inspect.getmembers(cls, lambda o: isinstance(o, property))
        if len(class_methods) > 0:
            doc.append("### Methods \n\n")
            for method_name, method in class_methods:
                doc += to_doc(method_name, method, 4, source_location)
    for fname, func in sorted(deffed_funcs):
        doc += to_doc(fname, func, 2, source_location)
    return doc_path.absolute(), "".join(doc)