<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_fmt_with_notebook_options(self, metadata):
 """Update format options with the values in the notebook metadata, and record those options in the notebook metadata"""

        # format options in notebook have precedence over that in fmt
        for opt in _VALID_FORMAT_OPTIONS:
            if opt in metadata.get('jupytext', {}):
                self.fmt.setdefault(opt, metadata['jupytext'][opt])
            if opt in self.fmt:
                metadata.setdefault('jupytext', {}).setdefault(opt, self.fmt[opt])

        # rST to md conversion should happen only once
        if metadata.get('jupytext', {}).get('rst2md') is True:
            metadata['jupytext']['rst2md'] = False