def clean_doc_str(doc, overview=False):
    """
    Transform a Python doc string into a Markdown string.

    First, it finds the indentation of the whole block.  It's assumed that
    everything in the block shares the same basic indentation.

    Any line that starts with ":" is considered to be Python meta-information,
    and is stripped out.  If the line following the ":" has the same indention
    and is not whitespace, it too is stripped out.

    For markdown support, lines with the same indention immediately after each
    other are considered to be the same line, and are joined together.
    """
    doc = doc or ''
    ret = ''
    current = ''
    base_indent = 0
    prev_indent = 0
    strip_prev = False

    def get_indent(val: str) -> int:
        ind = 0
        while ind < len(val) and val[ind].isspace():
            ind += 1
        if ind >= len(val):
            return 0
        return ind

    for o_line in doc.splitlines():
        line = o_line.rstrip()
        curr_indent = get_indent(line)

        # Check for Python meta-data
        if line and line.lstrip()[0] == ':':
            prev_indent = curr_indent
            strip_prev = True
            continue
        if curr_indent == prev_indent and strip_prev:
            continue

        if not ret and line:
            # First non-empty line.
            base_indent = get_indent(line)
            prev_indent = base_indent
            current += ' ' + line[base_indent:]
            continue

        if not line:
            # Empty line
            if current:
                if ret and overview:
                    return ret.lstrip()
                ret += '\n\n' + current.lstrip()
                current = ''
            # leave the previous indent the same.
            continue

        # Note a single newline, not space.  This is important.
        current += '\n' + line[base_indent:].lstrip()

    if current:
        ret += '\n\n' + current
    if not ret:
        ret = '(no documentation provided)'
    return ret.lstrip()