def _line_prefixes(mesos_files):
    file_ids = [str(y) for y in mesos_files]
    common_prefix = os.path.commonprefix(file_ids)
    common_suffix = os.path.commonprefix([x[::-1] for x in file_ids])[::-1]

    prefixes = {}
    colours = itertools.cycle(["red", "green", "yellow", "blue", "magenta", "cyan"])
    for f, colour in zip(mesos_files, colours):
        prefixes[str(f)] = (
            str(f).replace(common_prefix, "").replace(common_suffix, ""),
            colour,
        )

    return prefixes
Generate the shortest possible line prefixes to prepend to log lines.
dataset/ETHPy150Open shopkeep/shpkpr/shpkpr/files.py/_line_prefixes