def WithArgs(self, **kwargs):
    """Creates a new Measurement, see openhtf.PhaseInfo.WithArgs."""
    new_meas = mutablerecords.CopyRecord(self)
    if '{' in new_meas.name:
      formatter = lambda x: x.format(**kwargs) if x else x
    else:
      # str % {'a': 1} is harmless if str doesn't use any interpolation.
      # .format is as well, but % is more likely to be used in other contexts.
      formatter = lambda x: x % kwargs if x else x
    new_meas.name = formatter(self.name)
    new_meas.docstring = formatter(self.docstring)
    return new_meas
dataset/ETHPy150Open google/openhtf/openhtf/util/measurements.py/Measurement.WithArgs/original