def getRequestHeader(request, name):
 retVal = None
 if (request and name):
  _ = name.upper()
  retVal = max([(value if (_ == key.upper()) else None) for (key, value) in request.header_items()])
 return retVal

def getRequestHeader ( request , name ) : retVal = None if ( request and name ) : _ = name . upper ( ) retVal = max ( [ ( value if ( _ == key . upper ( ) ) else None ) for ( key , value ) in request . header_items ( ) ] ) return retVal
solving an issue with an urllib2 request header case sensitivity reference: URL .