chain of responsibility pattern class dispatcher(object)def __init__(selfhandlers=[])self handlers handlers def handle_request(selfrequest)for handler in self handlersrequest handler(requestreturn request the dispatcher class takes advantage of the fact that everything in python is an objectincluding functions since functions are first-class citizens (which means they can be passed to function and be returned from functionwe can instantiate the dispatcher and pass in list of functionswhich can be saved like any other list when the time comes to execute the functionswe iterate over the list and execute each function in turn implementing the sample code we have been using in this section using the dispatcher looks like thisclass dispatcher(object)def __init__(selfhandlers=[])self handlers handlers def handle_request(selfrequest)for handle in self handlersrequest handle(requestreturn request def function_ (in_string)print(in_stringreturn "join([ for in in_string if !' ']def function_ (in_string)print(in_stringreturn "join([ for in in_string if !' ']