def _MangleMeasurement(name, value, measurement, mangled_parameters):
  """Flatten parameters for backwards compatibility, watch for collisions.

  We generate these by doing some name mangling, using some sane limits for
  very large multidimensional measurements.
  """
  for current_value in value[:MAX_PARAMS_PER_MEASUREMENT]:
    # Mangle names so they look like 'myparameter_Xsec_Ynm_ZHz'
    mangled_name = '_'.join([name] + [
        '%s%s' % (
          dim_val,
          dim_units.uom_suffix if dim_units.uom_suffix else '') for
        dim_val, dim_units in zip(
          current_value[:-1], measurement.dimensions)])
    while mangled_name in mangled_parameters:
      logging.warning('Mangled name %s already in use', mangled_name)
      mangled_name += '_'
    mangled_param = testrun_pb2.TestParameter()
    mangled_param.name = mangled_name
    mangled_param.numeric_value = float(current_value[-1])
    if measurement.units:
      mangled_param.unit_code = UOM_CODE_MAP[measurement.units.uom_code]
    mangled_param.description = (
        'Mangled parameter from measurement %s with dimensions %s' % (
        name, tuple(d.uom_suffix for d in measurement.dimensions)))
    for validator in measurement.validators:
      mangled_param.description += '\nValidator: ' + str(validator)
    mangled_parameters[mangled_name] = mangled_param
dataset/ETHPy150Open google/openhtf/openhtf/io/output/mfg_inspector.py/_MangleMeasurement/original