code: def validate_metadata(train_config):
    
  
    # Make sure we have a default for every column
    if len(train_config['csv_header']) != len(train_config['csv_defaults']):
      raise ValueError('Unequal number of columns in input features file and '
                       'schema file.')
  
    # Check there are no missing columns. sorted_colums has two copies of the
    # target column because the target column is also listed in
    # categorical_columns or numerical_columns.
    sorted_columns = sorted(train_config['csv_header'] +
                            [train_config['target_column']])
  
    sorted_columns2 = sorted(train_config['categorical_columns'] +
                             train_config['numerical_columns'] +
                             [train_config['key_column']] +
                             [train_config['target_column']])
    if sorted_columns2 != sorted_columns:
      raise ValueError('Each csv header must be a numerical/categorical type, a '
                       ' key, or a target.')
docs: Perform some checks that the trainig config is correct.
  
    Args:
      train_config: train config as produced by merge_metadata()
  
    Raises:
      ValueError: if columns look wrong.