def set_end_datetime(self, value, timezone=None):
        """
        Set the end time of the time range.

        :param datetime.datetime/str value: |param_end_datetime|
        :raises ValueError: If the value is invalid as a |datetime| value.

        :Sample Code:
            .. code:: python

                from datetimerange import DateTimeRange
                time_range = DateTimeRange()
                print(time_range)
                time_range.set_end_datetime("2015-03-22T10:10:00+0900")
                print(time_range)
        :Output:
            .. parsed-literal::

                NaT - NaT
                NaT - 2015-03-22T10:10:00+0900
        """

        if value is None:
            self.__end_datetime = None
            return

        try:
            self.__end_datetime = typepy.type.DateTime(
                value, strict_level=typepy.StrictLevel.MIN, timezone=timezone
            ).convert()
        except typepy.TypeConversionError as e:
            raise ValueError(e)