def __repr__(self):
        return "<Requirement(package={package}, version='{version}')>".format(
            package=self.package, version=self.version)
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