def encode_header_item(cls, item):
        """Encode an HTTP header for sending over the wire."""
        if isinstance(item, str):
            item = cls.encode(item)

        # See header_translate_* constants above.
        # Replace only if you really know what you're doing.
        return item.translate(
            header_translate_table,
            header_translate_deletechars,
        )
Encode an HTTP header for sending over the wire.
cherrypy/lib/httputil.py