nodes: 0, module; 1, function_definition; 2, function_name:sort_by_priority; 3, parameters; 4, block; 5, identifier:iterable; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:reverse; 11, False; 12, identifier:default_priority; 13, integer:10; 14, comment:"""
      Return a list or objects sorted by a priority value.
      """; 15, call; 16, identifier:sorted; 17, argument_list; 18, identifier:iterable; 19, keyword_argument; 20, keyword_argument; 21, identifier:reverse; 22, identifier:reverse; 23, identifier:key; 24, lambda; 25, lambda_parameters; 26, call; 27, identifier:o; 28, identifier:getattr; 29, argument_list; 30, identifier:o; 31, string; 32, identifier:default_priority; 33, string_content:priority
code: def sort_by_priority(iterable, reverse=False, default_priority=10):
      """
      Return a list or objects sorted by a priority value.
      """
      return sorted(iterable, reverse=reverse, key=lambda o: getattr(o, 'priority', default_priority))