#NEWLINE# @ contract #NEWLINE# def append_host_data_locally( path , cpu_mhz , data_length ) : #NEWLINE# #INDENT# ' Write a CPU MHz value for the host.\n\n    :param path: A path to write the data to.\n     :type path: str\n\n    :param cpu_mhz: A CPU MHz value.\n     :type cpu_mhz: int,>=0\n\n    :param data_length: The maximum allowed length of the data.\n     :type data_length: int\n    ' #NEWLINE# if ( not os . access ( path , os . F_OK ) ) : #NEWLINE# #INDENT# with open ( path , 'w' ) as f : #NEWLINE# #INDENT# f . write ( ( str ( cpu_mhz ) + '\n' ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# with open ( path , 'r+' ) as f : #NEWLINE# #INDENT# values = deque ( f . read ( ) . strip ( ) . splitlines ( ) , data_length ) #NEWLINE# values . append ( cpu_mhz ) #NEWLINE# f . truncate ( 0 ) #NEWLINE# f . seek ( 0 ) #NEWLINE# f . write ( ( '\n' . join ( [ str ( x ) for x in values ] ) + '\n' ) )