def _ExtractAttachments(phase, testrun, used_parameter_names):
  """Extract attachments, just copy them over."""
  for name, (data, mimetype) in sorted(phase.attachments.items()):
    while used_parameter_names in name:
      name += '_'  # Hack to avoid collisions between phases.
    used_parameter_names.add(name)
    testrun_param = testrun.info_parameters.add()
    testrun_param.name = name
    testrun_param.value_binary = data
    if mimetype in MIMETYPE_MAP:
      testrun_param.type = MIMETYPE_MAP[mimetype]
    else:
      # pylint: disable=no-member
      testrun_param.type = testrun_pb2.InformationParameter.BINARY
      # pylint: enable=no-member
dataset/ETHPy150Open google/openhtf/openhtf/io/output/mfg_inspector.py/_ExtractAttachments/swapped operands of `in`