def METHOD_NAME():
    args = parse_arguments()
    if args.py is None:
        raise ValueError('The --py option must be specified.')
    mode_str = args.mode
    if not mode_str:
        mode_str = os.environ.get(_KF_PIPELINES_COMPILER_MODE_ENV, 'V1')
    mode = None
    if mode_str == 'V1_LEGACY' or mode_str == 'V1':
        mode = kfp.dsl.PipelineExecutionMode.V1_LEGACY
    elif mode_str == 'V2_COMPATIBLE':
        mode = kfp.dsl.PipelineExecutionMode.V2_COMPATIBLE
    elif mode_str == 'V2_ENGINE':
        mode = kfp.dsl.PipelineExecutionMode.V2_ENGINE
    else:
        raise ValueError(
            f'Got unexpected --mode option "{mode_str}", it must be one of V1, V2_COMPATIBLE or V2_ENGINE'
        )
    compile_pyfile(
        args.py,
        args.output,
        args.function,
        not args.disable_type_check,
        mode,
    )