advanced programming techniques def make_strip_function(characters)def strip_function(string)return string strip(charactersreturn strip_function strip_punctuation make_strip_function(",;!?"strip_punctuation("land ahoy!"returns'land ahoythe make_strip_function(function takes the characters to be stripped as its sole argument and returns functionstrip_function()that takes string argument and which strips the characters that were given at the time the closure was created so just as we can create as many instances of the strip class as we wanteach with its own characters to stripwe can create as many strip functions with their own characters as we like the classic use case for functors is to provide key functions for sort routines here is generic sortkey functor class (from file sortkey py)class sortkeydef __init__(self*attribute_names)self attribute_names attribute_names def __call__(selfinstance)values [for attribute_name in self attribute_namesvalues append(getattr(instanceattribute_name)return values when sortkey object is created it keeps tuple of the attribute names it was initialized with when the object is called it creates list of the attribute values for the instance it is passed--in the order they were specified when the sortkey was initialized for exampleimagine we have person classclass persondef __init__(selfforenamesurnameemail)self forename forename self surname surname self email email suppose we have list of person objects in the people list we can sort the list by surnames like thispeople sort(key=sortkey("surname")if there are lot of people there are bound to be some surname clashesso we can sort by surnameand then by forename within surnamelike thispeople sort(key=sortkey("surname""forename")and if we had people with the same surname and forename we could add the email attribute too and of