#NEWLINE# def _get_device_id( self ) : #NEWLINE# #INDENT# 'Returns the saved device id or creates a new one and saves it.' #NEWLINE# device_id = self . cache . get ( 'device_id' ) #NEWLINE# if ( not device_id ) : #NEWLINE# #INDENT# char_set = ( string . ascii_letters + string . digits ) #NEWLINE# device_id = '' . join ( random . sample ( char_set , 32 ) ) #NEWLINE# self . cache . set ( 'device_id' , device_id , ( ( ( 365 * 24 ) * 60 ) * 60 ) ) #NEWLINE# #UNINDENT# return device_id