nodes: 0, module; 1, function_definition; 2, function_name:order_by_on_list; 3, parameters; 4, block; 5, identifier:objects; 6, identifier:order_field; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, function_definition; 11, expression_statement; 12, identifier:is_desc; 13, False; 14, comment:"""
      Utility function to sort objects django-style even for non-query set collections
  
      :param objects: list of objects to sort
      :param order_field: field name, follows django conventions, so "foo__bar" means `foo.bar`, can be a callable.
      :param is_desc: reverse the sorting
      :return:
      """; 15, call; 16, block; 17, function_name:order_key; 18, parameters; 19, block; 20, call; 21, identifier:callable; 22, argument_list; 23, expression_statement; 24, return_statement; 25, identifier:x; 26, expression_statement; 27, if_statement; 28, return_statement; 29, attribute; 30, argument_list; 31, identifier:order_field; 32, call; 33, assignment; 34, comparison_operator:v is None; 35, block; 36, identifier:v; 37, identifier:objects; 38, identifier:sort; 39, keyword_argument; 40, keyword_argument; 41, attribute; 42, argument_list; 43, identifier:v; 44, call; 45, identifier:v; 46, None; 47, return_statement; 48, identifier:key; 49, identifier:order_key; 50, identifier:reverse; 51, identifier:is_desc; 52, identifier:objects; 53, identifier:sort; 54, keyword_argument; 55, keyword_argument; 56, identifier:getattr_path; 57, argument_list; 58, identifier:MIN; 59, identifier:key; 60, identifier:order_field; 61, identifier:reverse; 62, identifier:is_desc; 63, identifier:x; 64, identifier:order_field
code: def order_by_on_list(objects, order_field, is_desc=False):
      """
      Utility function to sort objects django-style even for non-query set collections
  
      :param objects: list of objects to sort
      :param order_field: field name, follows django conventions, so "foo__bar" means `foo.bar`, can be a callable.
      :param is_desc: reverse the sorting
      :return:
      """
      if callable(order_field):
          objects.sort(key=order_field, reverse=is_desc)
          return
  
      def order_key(x):
          v = getattr_path(x, order_field)
          if v is None:
              return MIN
          return v
  
      objects.sort(key=order_key, reverse=is_desc)