def filter_headers(headers, remove_headers):
 remove_headers = [((h, None) if isinstance(h, basestring) else h) for h in remove_headers]
 remove_headers = dict(((h.lower(), v) for (h, v) in remove_headers))
 headers = dict(((h, remove_headers.get(h.lower(), v)) for (h, v) in headers.items()))
 headers = dict(((h, v) for (h, v) in headers.items() if (v is not None)))
 return headers

def filter_headers ( headers , remove_headers ) : remove_headers = [ ( ( h , None ) if isinstance ( h , basestring ) else h ) for h in remove_headers ] remove_headers = dict ( ( ( h . lower ( ) , v ) for ( h , v ) in remove_headers ) ) headers = dict ( ( ( h , remove_headers . get ( h . lower ( ) , v ) ) for ( h , v ) in headers . items ( ) ) ) headers = dict ( ( ( h , v ) for ( h , v ) in headers . items ( ) if ( v is not None ) ) ) return headers
remove undesired headers from the provided headers dict .