#NEWLINE# def get_key_from_stat( key , type = None ) : #NEWLINE# #INDENT# sa = dbsession . query ( Stat ) . filter ( ( Stat . key == key ) ) . one ( ) #NEWLINE# val = json . loads ( sa . value ) #NEWLINE# if ( type == 'datetime' ) : #NEWLINE# #INDENT# val = datetime . fromtimestamp ( val ) . replace ( tzinfo = pytz . utc ) #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'key' : key , #NEWLINE# 'value' : val , #NEWLINE# 'sa' : sa , #NEWLINE# #UNINDENT# }