<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def color_stream_st(istream=sys.stdin, save_palette=False, **kwargs):
 """ Read filenames from the input stream and detect their palette. """

    for line in istream:
        filename = line.strip()
        try:
            palette = extract_colors(filename, **kwargs)

        except Exception as e:
            print(filename, e, file=sys.stderr)
            continue

        print_colors(filename, palette)
        if save_palette:
            save_palette_as_image(filename, palette)