# Buggy code
def fromstring(cls, s):
    """Creates a new instance of the LsColors class from a colon-separated
    string of dircolor-valid keys to ANSI color escape sequences.
    """
    obj = cls()
    # string inputs always use default codes, so translating into
    # xonsh names should be done from defaults
    reversed_default = ansi_reverse_style(style="default")
    data = {}
    for item in s.split(":"):
        key, eq, esc = item.partition("=")
        if not eq:
            # not a valid item
            pass
        elif esc == "target":
            data[key] = ("TARGET",)
        else:
            try:
                data[key] = ansi_color_escape_code_to_name(
                    esc, "default", reversed_style=reversed_default
                )
            except Exception as e:
                print("xonsh:warning:" + str(e), file=sys.stderr)
                data[key] = ("NO_COLOR",)
    obj._d = data
    return obj


# Traceback (ValueError)
Traceback (most recent call last):
File /home/tim/.xonsh/lib64/python3.7/site-packages/xonsh/__amalgam__.py, line 24210, in main
return main_xonsh(args)
File /home/tim/.xonsh/lib64/python3.7/site-packages/xonsh/__amalgam__.py, line 24239, in main_xonsh
shell.shell.cmdloop()
File /home/tim/.xonsh/lib64/python3.7/site-packages/xonsh/ptk_shell/shell.py, line 197, in cmdloop
line = self.singleline(auto_suggest=auto_suggest)
File /home/tim/.xonsh/lib64/python3.7/site-packages/xonsh/ptk_shell/shell.py, line 101, in singleline
self.styler.style_name = env.get(XONSH_COLOR_STYLE)
File /home/tim/.xonsh/lib64/python3.7/site-packages/xonsh/__amalgam__.py, line 17732, in styler
self._styler = XonshStyle(env.get(XONSH_COLOR_STYLE))
File /home/tim/.xonsh/lib64/python3.7/site-packages/xonsh/pyghooks.py, line 345, in __init__
self.style_name = style_name
File /home/tim/.xonsh/lib64/python3.7/site-packages/xonsh/pyghooks.py, line 384, in style_name
color_token = color_token_by_name(xonsh_color, self.styles)
File /home/tim/.xonsh/lib64/python3.7/site-packages/xonsh/pyghooks.py, line 223, in color_token_by_name
pc = color_name_to_pygments_code(xc[0], styles)
File /home/tim/.xonsh/lib64/python3.7/site-packages/xonsh/pyghooks.py, line 143, in color_name_to_pygments_code
if token in styles:
File /usr/lib64/python3.7/collections/__init__.py, line 931, in __contains__
return any(key in m for m in self.maps)
File /usr/lib64/python3.7/collections/__init__.py, line 931, in <genexpr>
return any(key in m for m in self.maps)
File /usr/lib64/python3.7/_collections_abc.py, line 666, in __contains__
self[key]
File /home/tim/.xonsh/lib64/python3.7/site-packages/xonsh/pyghooks.py, line 312, in __getitem__
value = code_by_name(name, self.styles)
File /home/tim/.xonsh/lib64/python3.7/site-packages/xonsh/pyghooks.py, line 205, in code_by_name
code = color_name_to_pygments_code(fg, styles)
File /home/tim/.xonsh/lib64/python3.7/site-packages/xonsh/pyghooks.py, line 147, in color_name_to_pygments_code
raise ValueError(!r is not a color!.format(name))
ValueError: 'TARGET' is not a color!
Xonsh encountered an issue during launch
Failback to /bin/sh

# Fixed code
def fromstring(cls, s):
    """Creates a new instance of the LsColors class from a colon-separated
    string of dircolor-valid keys to ANSI color escape sequences.
    """
    obj = cls()
    # string inputs always use default codes, so translating into
    # xonsh names should be done from defaults
    reversed_default = ansi_reverse_style(style="default")
    for item in s.split(":"):
        key, eq, esc = item.partition("=")
        if not eq:
            # not a valid item
            pass
        elif esc == LsColors.target_value:  # really only for 'ln'
            obj[key] = esc
        else:
            try:
                obj[key] = ansi_color_escape_code_to_name(
                    esc, "default", reversed_style=reversed_default
                )
            except Exception as e:
                print("xonsh:warning:" + str(e), file=sys.stderr)
                obj[key] = ("NO_COLOR",)
    return obj