code: def terminate(self, end):
          
          if self.terminated:
              raise TdlError('Cannot terminate a closed list.')
          if end == LIST_TYPE:
              self.terminated = False
          elif end == EMPTY_LIST_TYPE:
              if self._last_path:
                  self[self._last_path] = None
              else:
                  self._avm = None
              self.terminated = True
          elif self._last_path:
              self[self._last_path] = end
              self.terminated = True
          else:
              raise TdlError('Empty list must be {} or {}'.format(
                  LIST_TYPE, EMPTY_LIST_TYPE))
docs: Set the value of the tail of the list.
  
          Adding values via :meth:`append` places them on the `FIRST`
          feature of some level of the feature structure (e.g.,
          `REST.FIRST`), while :meth:`terminate` places them on the
          final `REST` feature (e.g., `REST.REST`). If *end* is a
          :class:`Conjunction` or :class:`Term`, it is typically a
          :class:`Coreference`, otherwise *end* is set to
          `tdl.EMPTY_LIST_TYPE` or `tdl.LIST_TYPE`. This method does
          not necessarily close the list; if *end* is `tdl.LIST_TYPE`,
          the list is left open, otherwise it is closed.
  
          Args:
              end (str, :class:`Conjunction`, :class:`Term`): value to
              use as the end of the list.