def get(self, path, content=True, type=None, format=None, load_alternative_format=True):
        """ Takes a path for an entity and returns its model"""
        path = path.strip('/')
        ext = os.path.splitext(path)[1]

        # Not a notebook?
        if not self.exists(path) or (type != 'notebook' if type else ext not in self.all_nb_extensions()):
            return super(TextFileContentsManager, self).get(path, content, type, format)

        fmt = preferred_format(ext, self.preferred_jupytext_formats_read)
        if ext == '.ipynb':
            model = self._notebook_model(path, content=content)
        else:
            self.set_default_format_options(fmt, read=True)
            with mock.patch('nbformat.reads', _jupytext_reads(fmt)):
                model = self._notebook_model(path, content=content)

        if not load_alternative_format:
            return model

        if not content:
            # Modification time of a paired notebook, in this context - Jupyter is checking timestamp
            # before saving - is the most recent among all representations #118
            if path not in self.paired_notebooks:
                return model

            fmt, formats = self.paired_notebooks.get(path)
            for alt_path, _ in paired_paths(path, fmt, formats):
                if alt_path != path and self.exists(alt_path):
                    alt_model = self._notebook_model(alt_path, content=False)
                    if alt_model['last_modified'] > model['last_modified']:
                        model['last_modified'] = alt_model['last_modified']

            return model

        # We will now read a second file if this is a paired notebooks.
        nbk = model['content']
        jupytext_formats = nbk.metadata.get('jupytext', {}).get('formats') or self.default_formats(path)
        jupytext_formats = long_form_multiple_formats(jupytext_formats)

        # Compute paired notebooks from formats
        alt_paths = [(path, fmt)]
        if jupytext_formats:
            try:
                _, fmt = find_base_path_and_format(path, jupytext_formats)
                alt_paths = paired_paths(path, fmt, jupytext_formats)
                self.update_paired_notebooks(path, fmt, jupytext_formats)
            except InconsistentPath as err:
                self.log.info("Unable to read paired notebook: %s", str(err))
        else:
            if path in self.paired_notebooks:
                fmt, formats = self.paired_notebooks.get(path)
                alt_paths = paired_paths(path, fmt, formats)

        if len(alt_paths) > 1 and ext == '.ipynb':
            # Apply default options (like saving and reloading would do)
            jupytext_metadata = model['content']['metadata'].get('jupytext', {})
            self.set_default_format_options(jupytext_metadata, read=True)
            if jupytext_metadata:
                model['content']['metadata']['jupytext'] = jupytext_metadata

        org_model = model
        fmt_inputs = fmt
        path_inputs = path_outputs = path
        model_outputs = None

        # Source format is first non ipynb format found on disk
        if path.endswith('.ipynb'):
            for alt_path, alt_fmt in alt_paths:
                if not alt_path.endswith('.ipynb') and self.exists(alt_path):
                    self.log.info(u'Reading SOURCE from {}'.format(alt_path))
                    path_inputs = alt_path
                    fmt_inputs = alt_fmt
                    model_outputs = model
                    model = self.get(alt_path, content=content, type=type, format=format,
                                     load_alternative_format=False)
                    break
        # Outputs taken from ipynb if in group, if file exists
        else:
            for alt_path, _ in alt_paths:
                if alt_path.endswith('.ipynb') and self.exists(alt_path):
                    self.log.info(u'Reading OUTPUTS from {}'.format(alt_path))
                    path_outputs = alt_path
                    model_outputs = self.get(alt_path, content=content, type=type, format=format,
                                             load_alternative_format=False)
                    break

        try:
            check_file_version(model['content'], path_inputs, path_outputs)
        except Exception as err:
            raise HTTPError(400, str(err))

        # Before we combine the two files, we make sure we're not overwriting ipynb cells
        # with an outdated text file
        try:
            if model_outputs and model_outputs['last_modified'] > model['last_modified'] + \
                    timedelta(seconds=self.outdated_text_notebook_margin):
                raise HTTPError(
                    400,
                    '''{out} (last modified {out_last})
                    seems more recent than {src} (last modified {src_last})
                    Please either:
                    - open {src} in a text editor, make sure it is up to date, and save it,
                    - or delete {src} if not up to date,
                    - or increase check margin by adding, say,
                        c.ContentsManager.outdated_text_notebook_margin = 5 # in seconds # or float("inf")
                    to your .jupyter/jupyter_notebook_config.py file
                    '''.format(src=path_inputs, src_last=model['last_modified'],
                               out=path_outputs, out_last=model_outputs['last_modified']))
        except OverflowError:
            pass

        if model_outputs:
            combine_inputs_with_outputs(model['content'], model_outputs['content'], fmt_inputs)
        elif not path.endswith('.ipynb'):
            nbk = model['content']
            language = nbk.metadata.get('jupytext', {}).get('main_language', 'python')
            if 'kernelspec' not in nbk.metadata and language != 'python':
                kernelspec = kernelspec_from_language(language)
                if kernelspec:
                    nbk.metadata['kernelspec'] = kernelspec

        # Trust code cells when they have no output
        for cell in model['content'].cells:
            if cell.cell_type == 'code' and not cell.outputs and cell.metadata.get('trusted') is False:
                cell.metadata['trusted'] = True

        # Path and name of the notebook is the one of the original path
        model['path'] = org_model['path']
        model['name'] = org_model['name']

        return model
Takes a path for an entity and returns its model