'Reach out and slap the box in the power switch.
:params conmux_command: The command to run via the conmux interface
:params timeout: timelimit in seconds before the machine is
considered unreachable
:params wait: Whether or not to wait for the machine to reboot
:params num_attempts: Number of times to attempt hard reset erroring
on the last attempt.
:params halt: Halts the machine before hardresetting.
:params **wait_for_restart_kwargs: keyword arguments passed to
wait_for_restart()'

def hardreset(self, timeout=DEFAULT_REBOOT_TIMEOUT, wait=True, conmux_command='hardreset', num_attempts=1, halt=False, **wait_for_restart_kwargs):

    conmux_command = ("'~$%s'" % conmux_command)
    try:
        old_boot_id = self.get_boot_id()
    except (error.AutoservSSHTimeout, error.AutoservError):
        old_boot_id = 'unknown    boot_id    prior    to    SerialHost.hardreset'
    def reboot():
        if halt:
            self.halt()
        if (not self.run_conmux(conmux_command)):
            self.record('ABORT', None, 'reboot.start', 'hard    reset    unavailable')
            raise error.AutoservUnsupportedError('Hard    reset    unavailable')
        self.record('GOOD', None, 'reboot.start', 'hard    reset')
        if wait:
            warning_msg = 'Serial    console    failed    to    respond    to    hard    reset    attempt    (%s/%s)'
            for attempt in xrange((num_attempts - 1)):
                try:
                    self.wait_for_restart(timeout, log_failure=False, old_boot_id=old_boot_id, **wait_for_restart_kwargs)
                except error.AutoservShutdownError:
                    logging.warning(warning_msg, (attempt + 1), num_attempts)
                    self.run_conmux(conmux_command)
                else:
                    break
            else:
                try:
                    self.wait_for_restart(timeout, old_boot_id=old_boot_id, **wait_for_restart_kwargs)
                except error.AutoservShutdownError:
                    logging.warning(warning_msg, num_attempts, num_attempts)
                    msg = 'Host    did    not    shutdown'
                    raise error.AutoservShutdownError(msg)
    if self.job:
        self.job.disable_warnings('POWER_FAILURE')
    try:
        if wait:
            self.log_reboot(reboot)
        else:
            reboot()
    finally:
        if self.job:
            self.job.enable_warnings('POWER_FAILURE')
