<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def NewPathSpec(cls, type_indicator, **kwargs):
 """Creates a new path specification for the specific type indicator. Args: type_indicator (str):
 type indicator. kwargs (dict):
 keyword arguments depending on the path specification. Returns: PathSpec: path specification. Raises: KeyError: if path specification is not registered. """

    if type_indicator not in cls._path_spec_types:
      raise KeyError(
          'Path specification type: {0:s} not set.'.format(type_indicator))

    # An empty parent will cause parentless path specifications to raise
    # so we conveniently remove it here.
    if 'parent' in kwargs and kwargs['parent'] is None:
      del kwargs['parent']

    path_spec_type = cls._path_spec_types[type_indicator]
    return path_spec_type(**kwargs)