def visdom_send_metrics(vis, metrics, update='<STR_LIT:replace>'):
visited = {}<EOL>sorted_metrics = sorted(metrics.columns, key=_column_original_name)<EOL>for metric_basename, metric_list in it.groupby(sorted_metrics, key=_column_original_name):<EOL><INDENT>metric_list = list(metric_list)<EOL>for metric in metric_list:<EOL><INDENT>if vis.win_exists(metric_basename) and (not visited.get(metric, False)):<EOL><INDENT>update = update<EOL><DEDENT>elif not vis.win_exists(metric_basename):<EOL><INDENT>update = None<EOL><DEDENT>else:<EOL><INDENT>update = '<STR_LIT>'<EOL><DEDENT>vis.line(<EOL>metrics[metric].values,<EOL>metrics.index.values,<EOL>win=metric_basename,<EOL>name=metric,<EOL>opts={<EOL>'<STR_LIT:title>': metric_basename,<EOL>'<STR_LIT>': True<EOL>},<EOL>update=update<EOL>)<EOL>if metric_basename != metric and len(metric_list) > <NUM_LIT:1>:<EOL><INDENT>if vis.win_exists(metric):<EOL><INDENT>update = update<EOL><DEDENT>else:<EOL><INDENT>update = None<EOL><DEDENT>vis.line(<EOL>metrics[metric].values,<EOL>metrics.index.values,<EOL>win=metric,<EOL>name=metric,<EOL>opts={<EOL>'<STR_LIT:title>': metric,<EOL>'<STR_LIT>': True<EOL>},<EOL>update=update<EOL>)<EOL><DEDENT><DEDENT><DEDENT>
Send set of metrics to visdom