<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def patch(nml_path, nml_patch, out_path=None):
 """Create a new namelist based on an input namelist and reference dict. This function is equivalent to the ``read`` function of the ``Parser`` object with the patch output arguments. A patched namelist file will retain any formatting or comments from the original namelist file. Any modified values will be formatted based on the settings of the ``Namelist`` object. """

    parser = Parser()

    return parser.read(nml_path, nml_patch, out_path)