def clean_headers(headers):
 clean = {}
 try:
  for (k, v) in six.iteritems(headers):
   if (not isinstance(k, six.binary_type)):
    k = str(k)
   if (not isinstance(v, six.binary_type)):
    v = str(v)
   clean[_helpers._to_bytes(k)] = _helpers._to_bytes(v)
 except UnicodeEncodeError:
  from oauth2client.client import NonAsciiHeaderError
  raise NonAsciiHeaderError(k, ': ', v)
 return clean

def clean_headers ( headers ) : clean = { } try : for ( k , v ) in six . iteritems ( headers ) : if ( not isinstance ( k , six . binary_type ) ) : k = str ( k ) if ( not isinstance ( v , six . binary_type ) ) : v = str ( v ) clean [ _helpers . _to_bytes ( k ) ] = _helpers . _to_bytes ( v ) except UnicodeEncodeError : from oauth2client . client import NonAsciiHeaderError raise NonAsciiHeaderError ( k , ': ' , v ) return clean
forces header keys and values to be strings .