def dashify_headline(line):
    stripped_right = line.rstrip('#')
    stripped_both = stripped_right.lstrip('#')
    level = len(stripped_right) - len(stripped_both)
    stripped_wspace = stripped_both.strip()

    # character replacements
    replaced_colon = stripped_wspace.replace('.', '')
    replaced_slash = replaced_colon.replace('/', '')
    rem_nonvalids = ''.join([c if c in VALIDS
                             else '-' for c in replaced_slash])

    lowered = rem_nonvalids.lower()
    dashified = re.sub(r'(-)\1+', r'\1', lowered)  # remove duplicate dashes
    dashified = dashified.strip('-')  # strip dashes from start and end

    # exception '&' (double-dash in github)
    dashified = dashified.replace('-&-', '--')

    return [stripped_wspace, dashified, level]
Write the DNS message header.
dataset/ETHPy150Open phodal/awesome-iot/toc.py/dashify_headline--crossover with--dataset/ETHPy150Open catap/namebench/nb_third_party/dns/renderer.py/Renderer.write_header