code: def ordered_yaml(cfg, order=None):
      
      if order is None:
          order = ['name', 'model_type', 'segmentation_col', 'fit_filters',
                   'predict_filters',
                   'choosers_fit_filters', 'choosers_predict_filters',
                   'alts_fit_filters', 'alts_predict_filters',
                   'interaction_predict_filters',
                   'choice_column', 'sample_size', 'estimation_sample_size',
                   'prediction_sample_size',
                   'model_expression', 'ytransform', 'min_segment_size',
                   'default_config', 'models', 'coefficients', 'fitted']
  
      s = []
      for key in order:
          if key not in cfg:
              continue
          s.append(
              yaml.dump({key: cfg[key]}, default_flow_style=False, indent=4))
  
      for key in cfg:
          if key in order:
              continue
          s.append(
              yaml.dump({key: cfg[key]}, default_flow_style=False, indent=4))
  
      return '\n'.join(s)
docs: Convert a dictionary to a YAML string with preferential ordering
      for some keys. Converted string is meant to be fairly human readable.
  
      Parameters
      ----------
      cfg : dict
          Dictionary to convert to a YAML string.
      order: list
          If provided, overrides the default key ordering.
  
      Returns
      -------
      str
          Nicely formatted YAML string.