

def _convert_header_value(self, value):
    if isinstance(value, bytes_type):
        pass
    elif isinstance(value, unicode_type):
        value = value.encode('utf-8')
    elif isinstance(value, numbers.Integral):
        return str(value)
    elif isinstance(value, datetime.datetime):
        return httputil.format_timestamp(value)
    else:
        raise TypeError(('Unsupported header value %r' % value))
    if ((len(value) > 4000) or RequestHandler._INVALID_HEADER_CHAR_RE.search(value)):
        raise ValueError('Unsafe header value %r', value)
    return value

dataset/ETHPy150Open RobotWebTools/rosbridge_suite/rosbridge_server/src/tornado/web.py RequestHandler._convert_header_value/original