def METHOD_NAME(file_name, segbits):
    """
    Save segbits to a .db or .rdb file
    """
    with open(file_name, "w") as fp:
        for tag, bits in segbits.items():
            if not len(bits):
                continue
            line = tag + " "
            line += " ".join([bit_to_str(bit) for bit in sorted(list(bits))])
            fp.write(line + "\n")