def format_log_context(msg, connection=None, keyspace=None):
 connection_info = (connection or 'DEFAULT_CONNECTION')
 if keyspace:
  msg = '[Connection: {0}, Keyspace: {1}] {2}'.format(connection_info, keyspace, msg)
 else:
  msg = '[Connection: {0}] {1}'.format(connection_info, msg)
 return msg

def format_log_context ( msg , connection = None , keyspace = None ) : connection_info = ( connection or 'DEFAULT_CONNECTION' ) if keyspace : msg = '[Connection: {0}, Keyspace: {1}] {2}' . format ( connection_info , keyspace , msg ) else : msg = '[Connection: {0}] {1}' . format ( connection_info , msg ) return msg
format log message to add keyspace and connection context .