nodes: 0, module; 1, function_definition; 2, function_name:sorted_fields; 3, parameters; 4, block; 5, identifier:cls; 6, expression_statement; 7, for_statement; 8, comment:"""Get the names of all writable metadata fields, sorted in the
          order that they should be written.
  
          This is a lexicographic order, except for instances of
          :class:`DateItemField`, which are sorted in year-month-day
          order.
          """; 9, identifier:property; 10, call; 11, block; 12, identifier:sorted; 13, argument_list; 14, expression_statement; 15, call; 16, keyword_argument; 17, yield; 18, attribute; 19, argument_list; 20, identifier:key; 21, attribute; 22, identifier:property; 23, identifier:cls; 24, identifier:fields; 25, identifier:cls; 26, identifier:_field_sort_name
code: def sorted_fields(cls):
          """Get the names of all writable metadata fields, sorted in the
          order that they should be written.
  
          This is a lexicographic order, except for instances of
          :class:`DateItemField`, which are sorted in year-month-day
          order.
          """
          for property in sorted(cls.fields(), key=cls._field_sort_name):
              yield property