docstr: Create and save a copy of the script that initialized the Experiment if allowed to, and
  if :attr:`source_script` ends with a ".py" extension
docstr_tok: ["Create","and","save","a","copy","of","the","script","that","initialized","the","Experiment","if","allowed","to",",","and","if",":","attr",":","`","source_script","`","ends","with","a","``",".py","''","extension"]
code: def _create_script_backup(self):
      """Create and save a copy of the script that initialized the Experiment if allowed to, and
      if :attr:`source_script` ends with a ".py" extension"""
      #################### Attempt to Copy Source Script if Allowed ####################
      try:
          if not self.source_script.endswith(".py"):
              G.Env.result_paths["script_backup"] = None
  
          if G.Env.result_paths["script_backup"] is not None:
              self._source_copy_helper()
              G.log(
                  "Created source backup:  '{}'".format(
                      self.source_script
                  ),
                  4,
              )
          else:
              G.log(
                  "Skipped source backup:  '{}'".format(
                      self.source_script
                  ),
                  4,
              )
      #################### Exception Handling ####################
      except AttributeError as _ex:
          if G.Env is None:
              raise EnvironmentInactiveError(extra="\n{!s}".format(_ex))
          if not hasattr(G.Env, "result_paths"):
              raise EnvironmentInvalidError(
                  extra=f"G.Env lacks 'result_paths' attr\n{_ex!s}"
              )
          raise
      except KeyError as _ex:
          if "script_backup" not in G.Env.result_paths:
              raise EnvironmentInvalidError(
                  extra=f"G.Env.result_paths lacks 'script_backup' key\n{_ex!s}"
              )
          raise
  
imports: from hyperparameter_hunter.algorithm_handlers import identify_algorithm, identify_algorithm_hyperparameters
  from hyperparameter_hunter.data import TrainDataset, OOFDataset, HoldoutDataset, TestDataset
  from hyperparameter_hunter.experiment_core import ExperimentMeta
  from hyperparameter_hunter.feature_engineering import FeatureEngineer
  from hyperparameter_hunter.i_o.exceptions import EnvironmentInactiveError, EnvironmentInvalidError, RepeatedExperimentError
  from hyperparameter_hunter.i_o.recorders import RecorderList
  from hyperparameter_hunter.keys.makers import HyperparameterKeyMaker
  from hyperparameter_hunter.metrics import ScoringMixIn, get_formatted_target_metric
  from hyperparameter_hunter.models import model_selector
  from hyperparameter_hunter.settings import G
  from hyperparameter_hunter.utils.file_utils import RetryMakeDirs
  from abc import abstractmethod
  from copy import deepcopy
  from inspect import isclass
  import numpy
  import pandas
  import random
  import shutil
  from sys import exc_info
  from uuid import uuid4
  import warnings
  import sklearn.utils
label_desc: Use image node_id 14 for calling the BaseExperiment obj's underlying member method code with example usage: obj._create_script_backup() without return types