def unquote_header_value(value, is_filename=False):
 if (value and (value[0] == value[(-1)] == '"')):
  value = value[1:(-1)]
  if ((not is_filename) or (value[:2] != '\\\\')):
   return value.replace('\\\\', '\\').replace('\\"', '"')
 return value

def unquote_header_value ( value , is_filename = False ) : if ( value and ( value [ 0 ] == value [ ( - 1 ) ] == '"' ) ) : value = value [ 1 : ( - 1 ) ] if ( ( not is_filename ) or ( value [ : 2 ] != '\\\\' ) ) : return value . replace ( '\\\\' , '\\' ) . replace ( '\\"' , '"' ) return value
unquotes a header value .