nodes: 0, module; 1, function_definition; 2, function_name:save_yaml; 3, parameters; 4, comment:# type: (Dict, str, bool, bool) -> None; 5, block; 6, identifier:dictionary; 7, identifier:path; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, with_statement; 13, identifier:pretty; 14, False; 15, identifier:sortkeys; 16, False; 17, comment:"""Save dictionary to YAML file preserving order if it is an OrderedDict
  
      Args:
          dictionary (Dict): Python dictionary to save
          path (str): Path to YAML file
          pretty (bool): Whether to pretty print. Defaults to False.
          sortkeys (bool): Whether to sort dictionary keys. Defaults to False.
  
      Returns:
          None
      """; 18, identifier:sortkeys; 19, block; 20, with_clause; 21, block; 22, expression_statement; 23, with_item; 24, if_statement; 25, assignment; 26, as_pattern; 27, identifier:pretty; 28, block; 29, else_clause; 30, identifier:dictionary; 31, call; 32, call; 33, as_pattern_target; 34, expression_statement; 35, block; 36, identifier:dict; 37, argument_list; 38, identifier:open; 39, argument_list; 40, identifier:f; 41, call; 42, expression_statement; 43, identifier:dictionary; 44, identifier:path; 45, string; 46, attribute; 47, argument_list; 48, call; 49, string_content:w; 50, identifier:pyaml; 51, identifier:dump; 52, identifier:dictionary; 53, identifier:f; 54, attribute; 55, argument_list; 56, identifier:yaml; 57, identifier:dump; 58, identifier:dictionary; 59, identifier:f; 60, keyword_argument; 61, keyword_argument; 62, identifier:default_flow_style; 63, None; 64, identifier:Dumper; 65, attribute; 66, attribute; 67, identifier:CDumper; 68, identifier:yamlloader; 69, identifier:ordereddict
code: def save_yaml(dictionary, path, pretty=False, sortkeys=False):
      # type: (Dict, str, bool, bool) -> None
      """Save dictionary to YAML file preserving order if it is an OrderedDict
  
      Args:
          dictionary (Dict): Python dictionary to save
          path (str): Path to YAML file
          pretty (bool): Whether to pretty print. Defaults to False.
          sortkeys (bool): Whether to sort dictionary keys. Defaults to False.
  
      Returns:
          None
      """
      if sortkeys:
          dictionary = dict(dictionary)
      with open(path, 'w') as f:
          if pretty:
              pyaml.dump(dictionary, f)
          else:
              yaml.dump(dictionary, f, default_flow_style=None, Dumper=yamlloader.ordereddict.CDumper)