<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register(self, *args, **kwargs):
 """Register an option."""

    if self._frozen:
      raise FrozenRegistration(self.scope, args[0])

    # Prevent further registration in enclosing scopes.
    ancestor = self._parent_parser
    while ancestor:
      ancestor._freeze()
      ancestor = ancestor._parent_parser

    if kwargs.get('type') == bool:
      default = kwargs.get('default')
      if default is None:
        # Unless a tri-state bool is explicitly opted into with the `UnsetBool` default value,
        # boolean options always have an implicit boolean-typed default. We make that default
        # explicit here.
        kwargs['default'] = not self._ensure_bool(kwargs.get('implicit_value', True))
      elif default is UnsetBool:
        kwargs['default'] = None

    # Record the args. We'll do the underlying parsing on-demand.
    self._option_registrations.append((args, kwargs))
    if self._parent_parser:
      for arg in args:
        existing_scope = self._parent_parser._existing_scope(arg)
        if existing_scope is not None:
          raise Shadowing(self.scope, arg, outer_scope=self._scope_str(existing_scope))
    for arg in args:
      if arg in self._known_args:
        raise OptionAlreadyRegistered(self.scope, arg)
    self._known_args.update(args)