<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_table(the_con, dtype, verbose=False, output_dir="."):
 """ Return name of bad table, or False if no errors found. Calls validate_df then parses its output. """

    print("-I- Validating {}".format(dtype))
    # grab dataframe
    current_df = the_con.tables[dtype].df
    # grab data model
    current_dm = the_con.tables[dtype].data_model.dm[dtype]
    # run all validations (will add columns to current_df)
    current_df = validate_df(current_df, current_dm, the_con)
    # get names of the added columns
    value_col_names, present_col_names, type_col_names, missing_groups, validation_col_names = get_validation_col_names(current_df)
    # print out failure messages
    ofile = os.path.join(output_dir, "{}_errors.txt".format(dtype))
    failing_items = get_row_failures(current_df, value_col_names,
                                     type_col_names, verbose, outfile=ofile)
    bad_rows, bad_cols, missing_cols = get_bad_rows_and_cols(current_df, validation_col_names,
                                                             value_col_names, type_col_names,
                                                             verbose=True)
    # delete all validation rows
    current_df.drop(validation_col_names, axis=1, inplace=True)
    current_df.drop(missing_groups, axis=1, inplace=True)
    if len(failing_items):
        print("-I- Complete list of row errors can be found in {}".format(ofile))
        return dtype, bad_rows, bad_cols, missing_cols, missing_groups, failing_items
    elif len(missing_cols) or len(missing_groups):
        print("-I- You are missing some required headers")
        if len(missing_cols):
            print("-I- You are missing these required headers: {}".format(", ".join(missing_cols)))
        if len(missing_groups):
            formatted_groups = [group[11:] for group in missing_groups]
            print('-I- You need at least one header from these groups: {}'.format(", ".join(formatted_groups)))
        else:
            formatted_groups = []
        return dtype, bad_rows, bad_cols, missing_cols, formatted_groups, failing_items
    else:
        print("-I- No row errors found!")
        return False