<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_file_version(notebook, source_path, outputs_path):
 """Raise if file version in source file would override outputs"""

    if not insert_or_test_version_number():
        return

    _, ext = os.path.splitext(source_path)
    if ext.endswith('.ipynb'):
        return
    version = notebook.metadata.get('jupytext', {}).get('text_representation', {}).get('format_version')
    format_name = format_name_for_ext(notebook.metadata, ext)

    fmt = get_format_implementation(ext, format_name)
    current = fmt.current_version_number

    # Missing version, still generated by jupytext?
    if notebook.metadata and not version:
        version = current

    # Same version? OK
    if version == fmt.current_version_number:
        return

    # Version larger than minimum readable version
    if (fmt.min_readable_version_number or current) <= version <= current:
        return

    raise JupytextFormatError("File {} is in format/version={}/{} (current version is {}). "
                              "It would not be safe to override the source of {} with that file. "
                              "Please remove one or the other file."
                              .format(os.path.basename(source_path),
                                      format_name, version, current,
                                      os.path.basename(outputs_path)))