parameters: (self, name, func)
docstring: Add a callback from a hook.
docstring_summary: Add a callback from a hook.
docstring_tokens: Add a callback from a hook .
function: def add_hook(self, name, func):
          ''' Add a callback from a hook. '''
          if name not in self.hooks:
              raise ValueError("Unknown hook name %s" % name)
          if name in ('after_request'):
              self.hooks[name].insert(0, func)
          else:
              self.hooks[name].append(func)
function_tokens: def add_hook ( self , name , func ) : if name not in self . hooks : raise ValueError ( "Unknown hook name %s" % name ) if name in ( 'after_request' ) : self . hooks [ name ] . insert ( 0 , func ) else : self . hooks [ name ] . append ( func )