#NEWLINE# def charset_from_headers( headers ) : #NEWLINE# #INDENT# 'Parse charset from headers.\n\n    :param httplib2.Response headers: Request headers\n    :return: Defined encoding, or default to ASCII\n\n    ' #NEWLINE# match = re . search ( 'charset=([^ ;]+)' , headers . get ( 'content-type' , '' ) ) #NEWLINE# if match : #NEWLINE# #INDENT# charset = match . groups ( ) [ 0 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# charset = 'ascii' #NEWLINE# #UNINDENT# return charset