def _FlattenTrace(test_suite_name, chart_name, trace_name, trace, is_ref=False, tracing_links=None, benchmark_description=''):
    "Takes a trace dict from dashboard JSON and readies it for display.\n\n  Traces can be either scalars or lists; if scalar we take the value directly;\n  if list we average the values and compute their standard deviation. We also\n  extract fields that are normally part of v0 row dicts that are uploaded\n  using add_point but are actually part of traces in the v1.0 format.\n\n  Args:\n    test_suite_name: The name of the test suite (benchmark).\n    chart_name: The name of the chart to which this trace belongs.\n    trace_name: The name of the passed trace.\n    trace: A trace dict extracted from a dashboard JSON chart.\n    is_ref: A boolean which indicates whether this trace comes from a\n        reference build.\n    tracing_links: A dictionary mapping trace names to about:tracing trace\n        urls in cloud storage\n    benchmark_description: A string documenting the benchmark suite to which\n        this trace belongs.\n\n  Returns:\n    A dict containing units, value, and error for this trace.\n\n  Raises:\n    BadRequestError: The data wasn't valid.\n  "
    if ('@@' in chart_name):
        (tir_label, chart_name) = chart_name.split('@@')
        chart_name = ((chart_name + '/') + tir_label)
    (value, error) = _ExtractValueAndError(trace)
    tracing_uri = None
    if (tracing_links and (trace_name in tracing_links) and ('cloud_url' in tracing_links[trace_name])):
        tracing_uri = tracing_links[trace_name]['cloud_url'].replace('\\/', '/')
    trace_name = _EscapeName(trace_name)
    if (trace_name == 'summary'):
        subtest_name = chart_name
    else:
        subtest_name = ((chart_name + '/') + trace_name)
    name = ((test_suite_name + '/') + subtest_name)
    if ((trace_name == 'summary') and is_ref):
        name += '/ref'
    elif ((trace_name != 'summary') and is_ref):
        name += '_ref'
    row_dict = {'test': name, 'value': value, 'error': error, 'units': trace['units'], 'tracing_uri': tracing_uri, 'benchmark_description': benchmark_description}
    if ('improvement_direction' in trace):
        improvement_direction_str = trace['improvement_direction']
        if (improvement_direction_str is None):
            raise BadRequestError('improvement_direction must not be None')
        row_dict['higher_is_better'] = _ImprovementDirectionToHigherIsBetter(improvement_direction_str)
    return row_dict
Takes a trace dict from dashboard JSON and readies it for display.

Traces can be either scalars or lists; if scalar we take the value directly;
if list we average the values and compute their standard deviation. We also
extract fields that are normally part of v0 row dicts that are uploaded
using add_point but are actually part of traces in the v1.0 format.

Args:
  test_suite_name: The name of the test suite (benchmark).
  chart_name: The name of the chart to which this trace belongs.
  trace_name: The name of the passed trace.
  trace: A trace dict extracted from a dashboard JSON chart.
  is_ref: A boolean which indicates whether this trace comes from a
      reference build.
  tracing_links: A dictionary mapping trace names to about:tracing trace
      urls in cloud storage
  benchmark_description: A string documenting the benchmark suite to which
      this trace belongs.

Returns:
  A dict containing units, value, and error for this trace.

Raises:
  BadRequestError: The data wasn't valid.
def _FlattenTrace(test_suite_name, chart_name, trace_name, trace, is_ref=False, tracing_links=None, benchmark_description=):
    "Takes a trace dict from dashboard JSON and readies it for display.\n\n  Traces can be either scalars or lists; if scalar we take the value directly;\n  if list we average the values and compute their standard deviation. We also\n  extract fields that are normally part of v0 row dicts that are uploaded\n  using add_point but are actually part of traces in the v1.0 format.\n\n  Args:\n    test_suite_name: The name of the test suite (benchmark).\n    chart_name: The name of the chart to which this trace belongs.\n    trace_name: The name of the passed trace.\n    trace: A trace dict extracted from a dashboard JSON chart.\n    is_ref: A boolean which indicates whether this trace comes from a\n        reference build.\n    tracing_links: A dictionary mapping trace names to about:tracing trace\n        urls in cloud storage\n    benchmark_description: A string documenting the benchmark suite to which\n        this trace belongs.\n\n  Returns:\n    A dict containing units, value, and error for this trace.\n\n  Raises:\n    BadRequestError: The data wasn't valid.\n  "
    if ('@@' in chart_name):
        (tir_label, chart_name) = chart_name.split('@@')
        chart_name = ((chart_name + '/') + tir_label)
    (value, error) = _ExtractValueAndError(trace)
    tracing_uri = None
    if (tracing_links and (trace_name in tracing_links) and ('cloud_url' in tracing_links[trace_name])):
        tracing_uri = tracing_links[trace_name]['cloud_url'].replace('\\/', '/')
    trace_name = _EscapeName(trace_name)
    if (trace_name == 'summary'):
        subtest_name = chart_name
    else:
        subtest_name = ((chart_name + '/') + trace_name)
    name = ((test_suite_name + '/') + subtest_name)
    if ((trace_name == 'summary') and is_ref):
        name += '/ref'
    elif ((trace_name != 'summary') and is_ref):
        name += '_ref'
    row_dict = {'test': name, 'value': value, 'error': error, 'units': trace['units'], 'tracing_uri': tracing_uri, 'benchmark_description': benchmark_description}
    if ('improvement_direction' in trace):
        improvement_direction_str = trace['improvement_direction']
        if (improvement_direction_str is None):
            raise BadRequestError('improvement_direction must not be None')
        row_dict['higher_is_better'] = _ImprovementDirectionToHigherIsBetter(improvement_direction_str)
    return row_dict