nodes: 0, module; 1, function_definition; 2, function_name:sort_schemas; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:schemas_list; 7, expression_statement; 8, return_statement; 9, comment:""" Sort the provided list of schemas according to their priority.
  
          This also supports markers, and markers of a single type are also sorted according to the priority of the wrapped schema.
  
          :type schemas_list: list[CompiledSchema]
          :rtype: list[CompiledSchema]
          """; 10, call; 11, identifier:sorted; 12, argument_list; 13, identifier:schemas_list; 14, keyword_argument; 15, keyword_argument; 16, identifier:key; 17, lambda; 18, identifier:reverse; 19, True; 20, lambda_parameters; 21, tuple; 22, identifier:x; 23, comment:# Top-level priority:; 24, comment:# priority of the schema itself; 25, attribute; 26, comment:# Second-level priority (for markers of the common type); 27, comment:# This ensures that Optional(1) always goes before Optional(int); 28, conditional_expression:x.compiled.key_schema.priority if x.compiled_type == const.COMPILED_TYPE.MARKER else 0; 29, identifier:x; 30, identifier:priority; 31, attribute; 32, comparison_operator:x.compiled_type == const.COMPILED_TYPE.MARKER; 33, integer:0; 34, attribute; 35, identifier:priority; 36, attribute; 37, attribute; 38, attribute; 39, identifier:key_schema; 40, identifier:x; 41, identifier:compiled_type; 42, attribute; 43, identifier:MARKER; 44, identifier:x; 45, identifier:compiled; 46, identifier:const; 47, identifier:COMPILED_TYPE
code: def sort_schemas(cls, schemas_list):
          """ Sort the provided list of schemas according to their priority.
  
          This also supports markers, and markers of a single type are also sorted according to the priority of the wrapped schema.
  
          :type schemas_list: list[CompiledSchema]
          :rtype: list[CompiledSchema]
          """
          return sorted(schemas_list,
                        key=lambda x: (
                            # Top-level priority:
                            # priority of the schema itself
                            x.priority,
                            # Second-level priority (for markers of the common type)
                            # This ensures that Optional(1) always goes before Optional(int)
                            x.compiled.key_schema.priority if x.compiled_type == const.COMPILED_TYPE.MARKER else 0
                        ), reverse=True)