<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove_state_machine(self, state_machine_id):
 """Remove the state machine for a specified state machine id from the list of registered state machines. :param state_machine_id: the id of the state machine to be removed """

        import rafcon.core.singleton as core_singletons
        removed_state_machine = None
        if state_machine_id in self._state_machines:
            logger.debug("Remove state machine with id {0}".format(state_machine_id))
            removed_state_machine = self._state_machines.pop(state_machine_id)
        else:
            logger.error("There is no state_machine with state_machine_id: %s" % state_machine_id)
            return removed_state_machine

        # destroy execution history
        removed_state_machine.destroy_execution_histories()
        return removed_state_machine