nodes: 0, module; 1, function_definition; 2, function_name:register; 3, parameters; 4, block; 5, identifier:self; 6, identifier:func; 7, identifier:order; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, comment:"""
          Add a function to the filter chain.
  
          :param func: A callable which is to be added to the filter chain.
          :param order: An object indicating the ordering of the function
                        relative to the others.
          :return: Token representing the registration.
  
          Register the function `func` as a filter into the chain. `order` must
          be a value which is used as a sorting key to order the functions
          registered in the chain.
  
          The type of `order` depends on the use of the filter, as does the
          number of arguments and keyword arguments which `func` must accept.
          This will generally be documented at the place where the
          :class:`Filter` is used.
  
          Functions with the same order are sorted in the order of their
          addition, with the function which was added earliest first.
  
          Remember that all values passed to `order` which are registered at the
          same time in the same :class:`Filter` need to be totally orderable with
          respect to each other.
  
          The returned token can be used to :meth:`unregister` a filter.
          """; 14, assignment; 15, call; 16, call; 17, identifier:token; 18, identifier:token; 19, call; 20, attribute; 21, argument_list; 22, attribute; 23, argument_list; 24, attribute; 25, argument_list; 26, attribute; 27, identifier:append; 28, tuple; 29, attribute; 30, identifier:sort; 31, keyword_argument; 32, identifier:self; 33, identifier:Token; 34, identifier:self; 35, identifier:_filter_order; 36, identifier:order; 37, identifier:token; 38, identifier:func; 39, identifier:self; 40, identifier:_filter_order; 41, identifier:key; 42, lambda; 43, lambda_parameters; 44, subscript; 45, identifier:x; 46, identifier:x; 47, integer:0
code: def register(self, func, order):
          """
          Add a function to the filter chain.
  
          :param func: A callable which is to be added to the filter chain.
          :param order: An object indicating the ordering of the function
                        relative to the others.
          :return: Token representing the registration.
  
          Register the function `func` as a filter into the chain. `order` must
          be a value which is used as a sorting key to order the functions
          registered in the chain.
  
          The type of `order` depends on the use of the filter, as does the
          number of arguments and keyword arguments which `func` must accept.
          This will generally be documented at the place where the
          :class:`Filter` is used.
  
          Functions with the same order are sorted in the order of their
          addition, with the function which was added earliest first.
  
          Remember that all values passed to `order` which are registered at the
          same time in the same :class:`Filter` need to be totally orderable with
          respect to each other.
  
          The returned token can be used to :meth:`unregister` a filter.
          """
          token = self.Token()
          self._filter_order.append((order, token, func))
          self._filter_order.sort(key=lambda x: x[0])
          return token