def METHOD_NAME(
    obj: object,
    name_type: type[_NT] = Optional[str],
    value_type: type[_VT] = object,
) -> TypeGuard[tuple[_NT, _VT]]:
  """Returns `True` if `obj` is a name value pair, otherwise `False`.
  In TFF, a name value pair (or named field) is a `collection.abc.Sequence` of
  exactly two elements, a `name` (which can be `None`) and a `value`.
  Args:
    obj: The object to test.
    name_type: The type of the name.
    value_type: The type of the value.
  """
  if not isinstance(obj, Sequence) or len(obj) != 2:
    return False
  name, value = obj
  # Before Python 3.10, you could not pass a `Union Type` to isinstance, see
  # https://docs.python.org/3/library/functions.html#isinstance.
  if sys.version_info < (3, 10):
    def _unpack_type(x):
      origin = typing.get_origin(x)
      if origin is Union:
        return typing.get_args(name_type)
      elif origin is not None:
        return origin
      else:
        return x
    name_type = _unpack_type(name_type)
    value_type = _unpack_type(value_type)
  return isinstance(name, name_type) and isinstance(value, value_type)