<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def commit(self, commands="", confirmed=None, comment=None, at_time=None, synchronize=False, req_format='text'):
 """ Perform a commit operation. Purpose: Executes a commit operation. All parameters are optional. | commit confirm and commit at are mutually exclusive. All | the others can be used with each other and commit confirm/at. @param commands: A string or list of multiple commands | that the device will compare with. | If a string, it can be a single command, | multiple commands separated by commas, or | a filepath location of a file with multiple | commands, each on its own line. @type commands: str or list @param confirmed: integer value of the number of **seconds** to | confirm the commit for, if requested. @type confirmed: int @param comment: string that the user wants to comment the commit | with. Will show up in the 'show system commit' log. @type comment: str @param at_time: string designating the time at which the commit | should happen. Can be in one of two Junos approved | formats. @type comment: str @param synchronize: boolean set to true if desiring a commit | synchronize operation. @type synchronize: bool @param req_format: string to specify the response format. Accepts | either 'text' or 'xml' @type req_format: str @returns: The reply from the device. @rtype: str """

        # ncclient doesn't support a truly blank commit, so if nothing is
        # passed, use 'annotate system' to make a blank commit
        if not commands:
            commands = 'annotate system ""'
        clean_cmds = []
        for cmd in clean_lines(commands):
            clean_cmds.append(cmd)
        # try to lock the candidate config so we can make changes.
        self.lock()
        self._session.load_configuration(action='set', config=commands)
        results = ""
        # confirmed and commit at are mutually exclusive. commit confirm
        # takes precedence.
        if confirmed:
            results = self._session.commit(confirmed=True,
                                           timeout=str(confirmed),
                                           comment=comment,
                                           synchronize=synchronize)
        else:
            results = self._session.commit(comment=comment, at_time=at_time,
                                           synchronize=synchronize)
        self.unlock()
        if results:
            if req_format == 'xml':
                return results
            # commit() DOES NOT return a parse-able xml tree, so we
            # convert it to an ElementTree xml tree.
            results = ET.fromstring(results.tostring)
            out = ''
            for i in results.iter():
                # the success message is just a tag, so we need to get it
                # specifically.
                if i.tag == 'commit-check-success':
                    out += 'configuration check succeeds\n'
                elif i.tag == 'commit-success':
                    out += 'commit complete\n'
                elif i.tag == 'ok':
                    out += 'commit complete\n'
                # this is for normal output with a tag and inner text, it will
                # strip the inner text and add it to the output.
                elif i.text is not None:
                    if i.text.strip() + '\n' != '\n':
                        out += i.text.strip() + '\n'
                # this is for elements that don't have inner text,
                # it will add the tag to the output.
                elif i.text is None:
                    if i.tag + '\n' != '\n':
                        out += i.tag + '\n'
            return out
        return False