def warning(message, **kwargs):
    kwargs["fg"] = kwargs.get("fg", "red")
    click.secho(u"warning: {}".format(message), **kwargs)
def encode(value):
    if isinstance(value, bytes):
        value = value.decode(errors="surrogateescape")

    for char in ("\\", "\n", "\t"):
        value = value.replace(
            char, char.encode(encoding="unicode-escape").decode()
        )

    return value