def sort_method(node, settings=None):
 attr = 'name'
 if (settings and hasattr(settings, 'attr') and settings.attr):
  attr = settings.attr
 reverse = False
 if (settings and hasattr(settings, 'reverse')):
  reverse = settings.reverse
 if (not isinstance(attr, list)):
  attr = [attr]
 filter_ = partial(filter_method, settings=settings)
 excluder_ = partial(attributes_checker, attributes=attr)
 resources = filter((lambda x: (excluder_(x) and filter_(x))), node.walk_resources())
 return sorted(resources, key=attrgetter(*attr), reverse=reverse)

def sort_method ( node , settings = None ) : attr = 'name' if ( settings and hasattr ( settings , 'attr' ) and settings . attr ) : attr = settings . attr reverse = False if ( settings and hasattr ( settings , 'reverse' ) ) : reverse = settings . reverse if ( not isinstance ( attr , list ) ) : attr = [ attr ] filter_ = partial ( filter_method , settings = settings ) excluder_ = partial ( attributes_checker , attributes = attr ) resources = filter ( ( lambda x : ( excluder_ ( x ) and filter_ ( x ) ) ) , node . walk_resources ( ) ) return sorted ( resources , key = attrgetter ( * attr ) , reverse = reverse )
sorts the resources in the given node based on the given settings .