def edit_miz(  <EOL>infile: str,<EOL>outfile: str = None,<EOL>metar: typing.Union[str, Metar] = None,<EOL>time: str = None,<EOL>min_wind: int = <NUM_LIT:0>,<EOL>max_wind: int = <NUM_LIT><EOL>) -> str:<EOL>
if outfile is None:<EOL><INDENT>LOGGER.debug('<STR_LIT>', infile)<EOL>outfile = infile<EOL><DEDENT>else:<EOL><INDENT>LOGGER.debug('<STR_LIT>', infile, outfile)<EOL><DEDENT>mission_weather = mission_time = None<EOL>if metar:<EOL><INDENT>error, metar = emiz.weather.custom_metar.CustomMetar.get_metar(metar)<EOL>if error:<EOL><INDENT>return error<EOL><DEDENT>mission_weather = emiz.weather.mission_weather.MissionWeather(metar, min_wind=min_wind, max_wind=max_wind)<EOL><DEDENT>if time:<EOL><INDENT>try:<EOL><INDENT>mission_time = MissionTime.from_string(time)<EOL><DEDENT>except ValueError:<EOL><INDENT>return f'<STR_LIT>'<EOL><DEDENT><DEDENT>if not mission_weather and not mission_time:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>with Miz(infile) as miz:<EOL><INDENT>if mission_weather:<EOL><INDENT>LOGGER.debug('<STR_LIT>')<EOL>if not mission_weather.apply_to_miz(miz):<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT><DEDENT>if mission_time:<EOL><INDENT>LOGGER.debug('<STR_LIT>')<EOL>if not mission_time.apply_to_miz(miz):<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT><DEDENT>try:<EOL><INDENT>miz.zip(outfile)<EOL>return '<STR_LIT>'<EOL><DEDENT>except OSError:<EOL><INDENT>return f'<STR_LIT>'<EOL><DEDENT><DEDENT>
Edit an opened MIZ file and sets the time and date and the weather

Args:
    infile: source file
    outfile: output file (will default to source file)
    metar: metar string, ICAO or object to apply
    time: time string to apply (YYYYMMDDHHMMSS)
    min_wind: minimum wind
    max_wind: maximum wind

Returns:
    String containing error