def _SetUnknownFlag(self, name, value):
    """Returns value if setting flag |name| to |value| returned True.

    Args:
      name: Name of the flag to set.
      value: Value to set.

    Returns:
      Flag value on successful call.

    Raises:
      UnrecognizedFlagError
      IllegalFlagValueError
    """
    setter = self.__dict__['__set_unknown']
    if setter:
      try:
        setter(name, value)
        return value
      except (TypeError, ValueError):  # Flag value is not valid.
        raise exceptions.IllegalFlagValueError('"{1}" is not valid for --{0}'
                                               .format(name, value))
      except NameError:  # Flag name is not valid.
        pass
    raise exceptions.UnrecognizedFlagError(name, value)