def check_file_content(file):
    """Check if all mandatory headers and keys exist in file"""
    with open(file, 'r') as config_file:
        file_content = config_file.read()
    config_headers = ['MySQL', 'Backup', 'Encrypt', 'Compress', 'Commands']
    config_keys = ['mysql', 'mycnf', 'mysqladmin', 'mysql_user',
        'mysql_password', 'mysql_host', 'datadir', 'tmp_dir', 'backup_dir',
        'backup_tool', 'xtra_prepare', 'start_mysql_command',
        'stop_mysql_command', 'chown_command']
    for header in config_headers:
        if header not in file_content:
            raise KeyError("Mandatory header [%s] doesn't exist in %s" % (
                header, file))
    for key in config_keys:
        if key not in file_content:
            raise KeyError("Mandatory key '%s' doesn't exists in %s." % (
                key, file))
    return True
