@classmethod
  def Open(cls, **kwargs):
    """See IterOpen, but raises if multiple or no matches found."""
    handle_iter = cls.IterOpen(**kwargs)

    try:
      handle = next(handle_iter)
    except StopIteration:
      # No matching interface, raise.
      raise usb_exceptions.DeviceNotFoundError(
          'Open failed with args: %s', kwargs)

    try:
      multiple_handle = next(handle_iter)
    except __HOLE__:
      # Exactly one matching device, return it.
      return handle

    # We have more than one device, close the ones we opened and bail.
    handle.Close()
    multiple_handle.Close()
    raise usb_exceptions.MultipleInterfacesFoundError(kwargs)

  # pylint: disable=too-many-arguments
dataset/ETHPy150Open google/openhtf/openhtf/plugs/usb/local_usb.py/LibUsbHandle.Open