docs: def save_script_file_for_state_and_source_path(state, state_path_full, as_copy=False):
      """Saves the script file for a state to the directory of the state.
  
      The script name will be set to the SCRIPT_FILE constant.
  
      :param state: The state of which the script file should be saved
      :param str state_path_full: The path to the file system storage location of the state
      :param bool as_copy: Temporary storage flag to signal that the given path is not the new file_system_path
      """
      from rafcon.core.states.execution_state import ExecutionState
      if isinstance(state, ExecutionState):
          source_script_file = os.path.join(state.script.path, state.script.filename)
          destination_script_file = os.path.join(state_path_full, SCRIPT_FILE)
  
          try:
              write_file(destination_script_file, state.script_text)
          except Exception:
              logger.exception("Storing of script file failed: {0} -> {1}".format(state.get_path(),
                                                                                  destination_script_file))
              raise
  
          if not source_script_file == destination_script_file and not as_copy:
              state.script.filename = SCRIPT_FILE
              state.script.path = state_path_full