def _generateMetricSpecString(inferenceElement, metric,<EOL>params=None, field=None,<EOL>returnLabel=False):
metricSpecArgs = dict(metric=metric,<EOL>field=field,<EOL>params=params,<EOL>inferenceElement=inferenceElement)<EOL>metricSpecAsString = "<STR_LIT>" %'<STR_LIT:U+002CU+0020>'.join(['<STR_LIT>' % (item[<NUM_LIT:0>],item[<NUM_LIT:1>])<EOL>for item in metricSpecArgs.items()])<EOL>if not returnLabel:<EOL><INDENT>return metricSpecAsString<EOL><DEDENT>spec = MetricSpec(**metricSpecArgs)<EOL>metricLabel = spec.getLabel()<EOL>return metricSpecAsString, metricLabel<EOL>
Generates the string representation of a MetricSpec object, and returns
    the metric key associated with the metric.


    Parameters:
    -----------------------------------------------------------------------
    inferenceElement:
      An InferenceElement value that indicates which part of the inference this
      metric is computed on

    metric:
      The type of the metric being computed (e.g. aae, avg_error)

    params:
      A dictionary of parameters for the metric. The keys are the parameter names
      and the values should be the parameter values (e.g. window=200)

    field:
      The name of the field for which this metric is being computed

    returnLabel:
      If True, returns the label of the MetricSpec that was generated