import re


def _get_module_doc(module):
    """Get and format the documentation for a module"""
    doc = module.__doc__ or ""

    # Replace headlines with bold text
    doc = re.sub(r"([\w ]+:)\n-+", r"**\1**", doc)
    num_hash = min(2, module.__name__.count("."))

    return f"{'#' * num_hash} {module.__name__}\n{doc}"