#NEWLINE# def source_hashed( source_filename , prepared_options , thumbnail_extension , **kwargs ) : #NEWLINE# #INDENT# '\n    Generate a thumbnail filename of the source filename and options separately\n    hashed, along with the size.\n\n    The format of the filename is a 12 character base64 sha1 hash of the source\n    filename, the size surrounded by underscores, and an 8 character options\n    base64 sha1 hash of the thumbnail options. For example:\n    ``1xedFtqllFo9_100x100_QHCa6G1l.jpg``.\n    ' #NEWLINE# source_sha = hashlib . sha1 ( source_filename . encode ( 'utf-8' ) ) . digest ( ) #NEWLINE# source_hash = base64 . urlsafe_b64encode ( source_sha [ : 9 ] ) . decode ( 'utf-8' ) #NEWLINE# parts = ':' . join ( prepared_options [ 1 : ] ) #NEWLINE# parts_sha = hashlib . sha1 ( parts . encode ( 'utf-8' ) ) . digest ( ) #NEWLINE# options_hash = base64 . urlsafe_b64encode ( parts_sha [ : 6 ] ) . decode ( 'utf-8' ) #NEWLINE# return ( '%s_%s_%s.%s' % ( source_hash , prepared_options [ 0 ] , source_filename , thumbnail_extension ) )