# Buggy code
def detype(self):
    """De-types the instance, allowing it to be exported to the environment."""
    style = self.style
    if self._detyped is None:
        self._detyped = ":".join(
            [
                key
                + "="
                + ";".join(
                    [
                        "target"
                        if v == "TARGET"
                        else ansi_color_name_to_escape_code(v, cmap=style)
                        for v in val
                    ]
                )
                for key, val in sorted(self._d.items())
            ]
        )
    return self._detyped


# 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 detype(self):
    """De-types the instance, allowing it to be exported to the environment."""
    style = self.style
    if self._detyped is None:
        self._detyped = ":".join(
            [
                key
                + "="
                + ";".join(
                    [
                        LsColors.target_value
                        if key in self._targets
                        else ansi_color_name_to_escape_code(v, cmap=style)
                        for v in val
                    ]
                )
                for key, val in sorted(self._d.items())
            ]
        )
    return self._detyped