def lower_name(self):
    return self.name.lower()

def sort_view_items(self):
    name_field = 'name' if self.settings.case_sensitive else 'lower_name'
Set part of a lambda function in advance to avoid repeated code