'Commit the candidate configuration.
default (no options):
command_string = commit
confirm and confirm_delay:
command_string = commit confirmed <confirm_delay>
label (which is a label name):
command_string = commit label <label>
comment:
command_string = commit comment <comment>
supported combinations
label and confirm:
command_string = commit label <label> confirmed <confirm_delay>
label and comment:
command_string = commit label <label> comment <comment>
All other combinations will result in an exception.
failed commit message:
% Failed to commit one or more configuration items during a pseudo-atomic operation. All
changes made have been reverted. Please issue \'show configuration failed [inheritance]\'
from this session to view the errors
message XR shows if other commits occurred:
One or more commits have occurred from other configuration sessions since this session
started or since the last commit was made from this session. You can use the \'show
configuration commit changes\' command to browse the changes.
Exit of configuration mode with pending changes will cause the changes to be discarded and
an exception to be generated.'

def commit(self, confirm=False, confirm_delay=None, comment=u'', label=u'', delay_factor=1):

    delay_factor = self.select_delay_factor(delay_factor)
    if (confirm and (not confirm_delay)):
        raise ValueError(u'Invalid    arguments    supplied    to    XR    commit')
    if (confirm_delay and (not confirm)):
        raise ValueError(u'Invalid    arguments    supplied    to    XR    commit')
    if (comment and confirm):
        raise ValueError(u'Invalid    arguments    supplied    to    XR    commit')
    if comment:
        if (u'"' in comment):
            raise ValueError(u'Invalid    comment    contains    double    quote')
        comment = u'"{0}"'.format(comment)
    label = str(label)
    error_marker = u'Failed    to'
    alt_error_marker = u'One    or    more    commits    have    occurred    from    other'
    if label:
        if comment:
            command_string = u'commit    label    {0}    comment    {1}'.format(label, comment)
        elif confirm:
            command_string = u'commit    label    {0}    confirmed    {1}'.format(label, str(confirm_delay))
        else:
            command_string = u'commit    label    {0}'.format(label)
    elif confirm:
        command_string = u'commit    confirmed    {0}'.format(str(confirm_delay))
    elif comment:
        command_string = u'commit    comment    {0}'.format(comment)
    else:
        command_string = u'commit'
    output = self.config_mode()
    output += self.send_command_expect(command_string, strip_prompt=False, strip_command=False, delay_factor=delay_factor)
    if (error_marker in output):
        raise ValueError(u'Commit    failed    with    the    following    errors:\n\n{0}'.format(output))
    if (alt_error_marker in output):
        output += self.send_command_timing(u'no', strip_prompt=False, strip_command=False, delay_factor=delay_factor)
        raise ValueError(u'Commit    failed    with    the    following    errors:\n\n{0}'.format(output))
    return output
