<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_model( mzn, *, include=None, stdlib_dir=None, globals_dir=None ):
 """Perform model checking on a given model. This function calls the command ``minizinc --model-check-only`` to check for consistency of the given model. Parameters mzn : str The minizinc model. This can be either the path to the ``.mzn`` file or the content of the model itself. include : str or list One or more additional paths to search for included ``.mzn`` files. stdlib_dir : str The path to the MiniZinc standard library. Provide it only if it is different from the default one. globals_dir : str The path to the MiniZinc globals directory. Provide it only if it is different from the default one. Raises ------ ``MiniZincError`` if model checking fails. """


    args = ['--model-check-only']
    args += _flattening_args(
        mzn, include=include, stdlib_dir=stdlib_dir, globals_dir=globals_dir
    )

    input = mzn if args[-1] == '-' else None
    proc = _run_minizinc_proc(*args, input=input)

    if proc.stderr_data:
        raise MiniZincError(
            mzn if input is None else '\n' + mzn + '\n', args, proc.stderr_data
        )