def Shutdown(self):
    'Shuts down the simulator.'
    sim_state = self.GetSimulatorState()
    if (sim_state == ios_constants.SimState.SHUTDOWN):
        logging.info('Simulator %s has already shut down.', self.simulator_id)
        return
    if (sim_state == ios_constants.SimState.CREATING):
        raise ios_errors.SimError('Can not shut down the simulator in state CREATING.')
    logging.info('Shutting down simulator %s.', self.simulator_id)
    try:
        RunSimctlCommand(['xcrun', 'simctl', 'shutdown', self.simulator_id])
    except ios_errors.SimError as e:
        if ('Unable to shutdown device in current state: Shutdown' in str(e)):
            logging.info('Simulator %s has already shut down.', self.simulator_id)
            return
        raise ios_errors.SimError(('Failed to shutdown simulator %s: %s' % (self.simulator_id, str(e))))
    self.WaitUntilStateShutdown()
    logging.info('Shut down simulator %s.', self.simulator_id)
Shuts down the simulator.
def Shutdown(self):
    
    sim_state = self.GetSimulatorState()
    if (sim_state == ios_constants.SimState.SHUTDOWN):
        logging.info('Simulator %s has already shut down.', self.simulator_id)
        return
    if (sim_state == ios_constants.SimState.CREATING):
        raise ios_errors.SimError('Can not shut down the simulator in state CREATING.')
    logging.info('Shutting down simulator %s.', self.simulator_id)
    try:
        RunSimctlCommand(['xcrun', 'simctl', 'shutdown', self.simulator_id])
    except ios_errors.SimError as e:
        if ('Unable to shutdown device in current state: Shutdown' in str(e)):
            logging.info('Simulator %s has already shut down.', self.simulator_id)
            return
        raise ios_errors.SimError(('Failed to shutdown simulator %s: %s' % (self.simulator_id, str(e))))
    self.WaitUntilStateShutdown()
    logging.info('Shut down simulator %s.', self.simulator_id)