'Commit the candidate configuration.
Commit the entered configuration. Raise an error and return the failure
if the commit fails.
Automatically enters configuration mode
default:
command_string = commit
check and (confirm or confirm_dely or comment):
Exception
confirm_delay and no confirm:
Exception
confirm:
confirm_delay option
comment option
command_string = commit confirmed or commit confirmed <confirm_delay>
check:
command_string = commit check'

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

    delay_factor = self.select_delay_factor(delay_factor)
    if (check and (confirm or confirm_delay or comment)):
        raise ValueError(u'Invalid    arguments    supplied    with    commit    check')
    if (confirm_delay and (not confirm)):
        raise ValueError(u'Invalid    arguments    supplied    to    commit    method    both    confirm    and    check')
    command_string = u'commit'
    commit_marker = u'commit    complete'
    if check:
        command_string = u'commit    check'
        commit_marker = u'configuration    check    succeeds'
    elif confirm:
        if confirm_delay:
            command_string = (u'commit    confirmed    ' + str(confirm_delay))
        else:
            command_string = u'commit    confirmed'
        commit_marker = u'commit    confirmed    will    be    automatically    rolled    back    in'
    if comment:
        if (u'"' in comment):
            raise ValueError(u'Invalid    comment    contains    double    quote')
        comment = u'"{0}"'.format(comment)
        command_string += (u'    comment    ' + comment)
    if and_quit:
        command_string += u'    and-quit'
    output = self.config_mode()
    if and_quit:
        prompt = self.base_prompt
        output += self.send_command_expect(command_string, expect_string=prompt, strip_prompt=False, strip_command=False, delay_factor=delay_factor)
    else:
        output += self.send_command_expect(command_string, strip_prompt=False, strip_command=False, delay_factor=delay_factor)
    if (commit_marker not in output):
        raise ValueError(u'Commit    failed    with    the    following    errors:\n\n{0}'.format(output))
    return output
