class_docstr: Base class for storages.
  
  This class is not supposed to be directly accessed by library users.
  
  This class abstracts a backend database and provides internal interfaces to
  read/write histories of studies and trials.
  
  A storage class implementing this class must meet the following requirements.
  
  **Thread safety**
  
  A storage class instance can be shared among multiple threads, and must therefore be
  thread-safe. It must guarantee that a data instance read from the storage must not be modified
  by subsequent writes. For example, `FrozenTrial` instance returned by `get_trial`
  should not be updated by the subsequent `set_trial_xxx`. This is usually achieved by replacing
  the old data with a copy on `set_trial_xxx`.
  
  A storage class can also assume that a data instance returned are never modified by its user.
  When a user modifies a return value from a storage class, the internal state of the storage
  may become inconsistent. Consequences are undefined.
  
  **Ownership of RUNNING trials**
  
  Trials in finished states are not allowed to be modified.
  Trials in the WAITING state are not allowed to be modified except for the `state` field.
class_docstr_tok: ["Base","class","for","storages",".","This","class","is","not","supposed","to","be","directly","accessed","by","library","users",".","This","class","abstracts","a","backend","database","and","provides","internal","interfaces","to","read\/write","histories","of","studies","and","trials",".","A","storage","class","implementing","this","class","must","meet","the","following","requirements",".","*","*","Thread","safety","*","*","A","storage","class","instance","can","be","shared","among","multiple","threads",",","and","must","therefore","be","thread-safe",".","It","must","guarantee","that","a","data","instance","read","from","the","storage","must","not","be","modified","by","subsequent","writes",".","For","example",",","`","FrozenTrial","`","instance","returned","by","`","get_trial","`","should","not","be","updated","by","the","subsequent","`","set_trial_xxx","`",".","This","is","usually","achieved","by","replacing","the","old","data","with","a","copy","on","`","set_trial_xxx","`",".","A","storage","class","can","also","assume","that","a","data","instance","returned","are","never","modified","by","its","user",".","When","a","user","modifies","a","return","value","from","a","storage","class",",","the","internal","state","of","the","storage","may","become","inconsistent",".","Consequences","are","undefined",".","*","*","Ownership","of","RUNNING","trials","*","*","Trials","in","finished","states","are","not","allowed","to","be","modified",".","Trials","in","the","WAITING","state","are","not","allowed","to","be","modified","except","for","the","`","state","`","field","."]
docstr: Create and add a new trial to a study.
  
  The returned trial ID is unique among all current and deleted trials.
  
  Args:
      study_id:
          ID of the study.
      template_trial:
          Template :class:`~optuna.trial.FrozenTrial` with default user-attributes,
          system-attributes, intermediate-values, and a state.
  
  Returns:
      ID of the created trial.
  
  Raises:
      :exc:`KeyError`:
          If no study with the matching ``study_id`` exists.
docstr_tok: ["Create","and","add","a","new","trial","to","a","study",".","The","returned","trial","ID","is","unique","among","all","current","and","deleted","trials",".","Args",":","study_id",":","ID","of","the","study",".","template_trial",":","Template",":","class",":","`","~optuna.trial.FrozenTrial","`","with","default","user-attributes",",","system-attributes",",","intermediate-values",",","and","a","state",".","Returns",":","ID","of","the","created","trial",".","Raises",":",":","exc",":","`","KeyError","`",":","If","no","study","with","the","matching","``","study_id","``","exists","."]
code: def create_new_trial(
      self, study_id: int, template_trial: Optional[FrozenTrial] = None
  ) -> int:
      """Create and add a new trial to a study.
  
      The returned trial ID is unique among all current and deleted trials.
  
      Args:
          study_id:
              ID of the study.
          template_trial:
              Template :class:`~optuna.trial.FrozenTrial` with default user-attributes,
              system-attributes, intermediate-values, and a state.
  
      Returns:
          ID of the created trial.
  
      Raises:
          :exc:`KeyError`:
              If no study with the matching ``study_id`` exists.
      """
      raise NotImplementedError
  
imports: import abc
  from typing import Any
  from typing import cast
  from typing import Container
  from typing import Dict
  from typing import List
  from typing import Optional
  from typing import Sequence
  from typing import Tuple
  from typing import Union
  from optuna._typing import JSONSerializable
  from optuna.distributions import BaseDistribution
  from optuna.study._frozen import FrozenStudy
  from optuna.study._study_direction import StudyDirection
  from optuna.trial import FrozenTrial
  from optuna.trial import TrialState
label_desc: Use image node_id 11 for calling the BaseStorage obj's underlying member method code with example usage: obj.create_new_trial(study_id, template_trial) without return types