nodes: 0, module; 1, function_definition; 2, function_name:try_sort_fmt_opts; 3, parameters; 4, block; 5, identifier:rdf_format_opts_list; 6, identifier:uri; 7, expression_statement; 8, expression_statement; 9, comment:# print(filename, file_extension); 10, if_statement; 11, comment:"""reorder fmt options based on uri file type suffix - if available - so to test most likely serialization first when parsing some RDF 
  
      NOTE this is not very nice as it is hardcoded and assumes the origin serializations to be this: ['turtle', 'xml', 'n3', 'nt', 'json-ld', 'rdfa']
      
      """; 12, assignment; 13, boolean_operator; 14, block; 15, elif_clause; 16, elif_clause; 17, elif_clause; 18, elif_clause; 19, else_clause; 20, pattern_list; 21, call; 22, comparison_operator:file_extension == ".ttl"; 23, comparison_operator:file_extension == ".turtle"; 24, return_statement; 25, boolean_operator; 26, block; 27, boolean_operator; 28, block; 29, boolean_operator; 30, block; 31, comparison_operator:file_extension == ".rdfa"; 32, block; 33, block; 34, identifier:filename; 35, identifier:file_extension; 36, attribute; 37, argument_list; 38, identifier:file_extension; 39, string:".ttl"; 40, identifier:file_extension; 41, string:".turtle"; 42, list; 43, comparison_operator:file_extension == ".xml"; 44, comparison_operator:file_extension == ".rdf"; 45, return_statement; 46, comparison_operator:file_extension == ".nt"; 47, comparison_operator:file_extension == ".n3"; 48, return_statement; 49, comparison_operator:file_extension == ".json"; 50, comparison_operator:file_extension == ".jsonld"; 51, return_statement; 52, identifier:file_extension; 53, string:".rdfa"; 54, return_statement; 55, return_statement; 56, attribute; 57, identifier:splitext; 58, identifier:uri; 59, string; 60, string; 61, string; 62, string; 63, string; 64, string; 65, identifier:file_extension; 66, string:".xml"; 67, identifier:file_extension; 68, string:".rdf"; 69, list; 70, identifier:file_extension; 71, string:".nt"; 72, identifier:file_extension; 73, string:".n3"; 74, list; 75, identifier:file_extension; 76, string:".json"; 77, identifier:file_extension; 78, string:".jsonld"; 79, list; 80, list; 81, identifier:rdf_format_opts_list; 82, identifier:os; 83, identifier:path; 84, string_content:turtle; 85, string_content:n3; 86, string_content:nt; 87, string_content:json-ld; 88, string_content:rdfa; 89, string_content:xml; 90, string; 91, string; 92, string; 93, string; 94, string; 95, string; 96, string; 97, string; 98, string; 99, string; 100, string; 101, string; 102, string; 103, string; 104, string; 105, string; 106, string; 107, string; 108, string; 109, string; 110, string; 111, string; 112, string; 113, string; 114, string_content:xml; 115, string_content:turtle; 116, string_content:n3; 117, string_content:nt; 118, string_content:json-ld; 119, string_content:rdfa; 120, string_content:n3; 121, string_content:nt; 122, string_content:turtle; 123, string_content:xml; 124, string_content:json-ld; 125, string_content:rdfa; 126, string_content:json-ld; 127, string_content:rdfa; 128, string_content:n3; 129, string_content:nt; 130, string_content:turtle; 131, string_content:xml; 132, string_content:rdfa; 133, string_content:json-ld; 134, string_content:n3; 135, string_content:nt; 136, string_content:turtle; 137, string_content:xml
code: def try_sort_fmt_opts(rdf_format_opts_list, uri):
      """reorder fmt options based on uri file type suffix - if available - so to test most likely serialization first when parsing some RDF 
  
      NOTE this is not very nice as it is hardcoded and assumes the origin serializations to be this: ['turtle', 'xml', 'n3', 'nt', 'json-ld', 'rdfa']
      
      """
      filename, file_extension = os.path.splitext(uri)
      # print(filename, file_extension)
      if file_extension == ".ttl" or file_extension == ".turtle":
          return ['turtle', 'n3', 'nt', 'json-ld', 'rdfa', 'xml']
      elif file_extension == ".xml" or file_extension == ".rdf":
          return ['xml', 'turtle', 'n3', 'nt', 'json-ld', 'rdfa']
      elif file_extension == ".nt" or file_extension == ".n3":
          return ['n3', 'nt', 'turtle', 'xml', 'json-ld', 'rdfa']
      elif file_extension == ".json" or file_extension == ".jsonld":
          return [
              'json-ld',
              'rdfa',
              'n3',
              'nt',
              'turtle',
              'xml',
          ]
      elif file_extension == ".rdfa":
          return [
              'rdfa',
              'json-ld',
              'n3',
              'nt',
              'turtle',
              'xml',
          ]
      else:
          return rdf_format_opts_list