nodes: 0, module; 1, function_definition; 2, function_name:sorted; 3, parameters; 4, block; 5, identifier:collection; 6, expression_statement; 7, if_statement; 8, if_statement; 9, if_statement; 10, return_statement; 11, comment:"""
          sorting dict by key,
          schema-collection by schema-name
          operations by id
          """; 12, comparison_operator:len(collection) < 1; 13, block; 14, call; 15, block; 16, call; 17, block; 18, elif_clause; 19, else_clause; 20, call; 21, call; 22, integer:1; 23, return_statement; 24, identifier:isinstance; 25, argument_list; 26, return_statement; 27, identifier:isinstance; 28, argument_list; 29, expression_statement; 30, call; 31, block; 32, block; 33, identifier:sorted; 34, argument_list; 35, identifier:len; 36, argument_list; 37, identifier:collection; 38, identifier:collection; 39, identifier:dict; 40, call; 41, subscript; 42, identifier:Operation; 43, assignment; 44, identifier:isinstance; 45, argument_list; 46, expression_statement; 47, raise_statement; 48, identifier:collection; 49, keyword_argument; 50, identifier:collection; 51, identifier:sorted; 52, argument_list; 53, call; 54, integer:0; 55, identifier:key; 56, lambda; 57, subscript; 58, identifier:str; 59, assignment; 60, call; 61, identifier:key; 62, identifier:key; 63, call; 64, keyword_argument; 65, identifier:list; 66, argument_list; 67, lambda_parameters; 68, attribute; 69, call; 70, integer:0; 71, identifier:key; 72, lambda; 73, identifier:TypeError; 74, argument_list; 75, attribute; 76, argument_list; 77, identifier:key; 78, lambda; 79, identifier:collection; 80, identifier:x; 81, identifier:x; 82, identifier:operation_id; 83, identifier:list; 84, argument_list; 85, lambda_parameters; 86, attribute; 87, call; 88, identifier:collection; 89, identifier:items; 90, lambda_parameters; 91, subscript; 92, identifier:collection; 93, identifier:x; 94, call; 95, identifier:name; 96, identifier:type; 97, argument_list; 98, identifier:x; 99, identifier:x; 100, integer:0; 101, attribute; 102, argument_list; 103, subscript; 104, identifier:SchemaObjects; 105, identifier:get; 106, identifier:x; 107, identifier:collection; 108, integer:0
code: def sorted(collection):
          """
          sorting dict by key,
          schema-collection by schema-name
          operations by id
          """
          if len(collection) < 1:
              return collection
  
          if isinstance(collection, dict):
              return sorted(collection.items(), key=lambda x: x[0])
  
          if isinstance(list(collection)[0], Operation):
              key = lambda x: x.operation_id
          elif isinstance(list(collection)[0], str):
              key = lambda x: SchemaObjects.get(x).name
          else:
              raise TypeError(type(collection[0]))
          return sorted(collection, key=key)