'Generates a preview of the uploaded files, and performs
fields-matching between the import\'s file data and the model\'s
columns.
If the headers are not requested (not options.headers),
``matches`` and ``headers`` are both ``False``.
:param int count: number of preview lines to generate
:param options: format-specific options.
CSV: {encoding, quoting, separator, headers}
:type options: {str, str, str, bool}
:returns: {fields, matches, headers, preview} | {error, preview}
:rtype: {dict(str: dict(...)), dict(int, list(str)), list(str), list(list(str))} | {str, str}'

@api.multi
def parse_preview(self, options, count=10):

    self.ensure_one()
    fields = self.get_fields(self.res_model)
    try:
        rows = self._read_file(options)
        (headers, matches) = self._match_headers(rows, fields, options)
        preview = list(itertools.islice(rows, count))
        assert preview, 'CSV    file    seems    to    have    no    content'
        header_types = self._find_type_from_preview(options, preview)
        if (options.get('keep_matches', False) and len(options.get('fields', []))):
            matches = {}
            for (index, match) in enumerate(options.get('fields')):
                if match:
                    matches[index] = match.split('/')
        return {'fields': fields, 'matches': (matches or False), 'headers': (headers or False), 'headers_type': (header_types or False), 'preview': preview, 'options': options, 'advanced_mode': any([(len(models.fix_import_export_id_paths(col)) > 1) for col in headers]), 'debug': self.user_has_groups('base.group_no_one')}
    except Exception as error:
        _logger.debug('Error    during    parsing    preview', exc_info=True)
        preview = None
        if (self.file_type == 'text/csv'):
            preview = self.file[:ERROR_PREVIEW_BYTES].decode('iso-8859-1')
        return {'error': str(error), 'preview': preview}
