'Returns argument, or raises an exception if it is invalid.
HTTP header names are defined by RFC 2616 section 4.2.
Args:
name: HTTP header field value.
unused_key: Unused.
Returns:
name argument, unchanged.
Raises:
appinfo_errors.InvalidHttpHeaderName: argument cannot be used as an HTTP
header name.'

def Validate(self, name, unused_key=None):

    original_name = name
    if isinstance(name, unicode):
        try:
            name = name.encode('ascii')
        except UnicodeEncodeError:
            raise appinfo_errors.InvalidHttpHeaderName('HTTP    header    values    must    not    contain    non-ASCII    data')
    name = name.lower()
    if (not _HTTP_TOKEN_RE.match(name)):
        raise appinfo_errors.InvalidHttpHeaderName('An    HTTP    header    must    be    a    non-empty    RFC    2616    token.')
    if (name in _HTTP_REQUEST_HEADERS):
        raise appinfo_errors.InvalidHttpHeaderName(('%r    can    only    be    used    in    HTTP    requests,    not    responses.' % original_name))
    if name.startswith('x-appengine'):
        raise appinfo_errors.InvalidHttpHeaderName('HTTP    header    names    that    begin    with    X-Appengine    are    reserved.')
    if wsgiref.util.is_hop_by_hop(name):
        raise appinfo_errors.InvalidHttpHeaderName('Only    use    end-to-end    headers    may    be    used.    See    RFC    2616    section    13.5.1.')
    if (name in HttpHeadersDict.DISALLOWED_HEADERS):
        raise appinfo_errors.InvalidHttpHeaderName(('%s    is    a    disallowed    header.' % name))
    return original_name
