def from_date(cls, date, period=None):
        """
        Create a day long daterange from for the given date.

            >>> daterange.from_date(date(2000, 1, 1))
            daterange([datetime.date(2000, 1, 1),datetime.date(2000, 1, 2)))

        :param date: A date to convert.
        :param period: The period to normalize date to. A period may be one of:
                       ``day`` (default), ``week``, ``american_week``,
                       ``month``, ``quarter`` or ``year``.
        :return: A new range that contains the given date.


        .. seealso::

           There are convenience methods for most period types:
           :meth:`~spans.types.daterange.from_week`,
           :meth:`~spans.types.daterange.from_month`,
           :meth:`~spans.types.daterange.from_quarter` and
           :meth:`~spans.types.daterange.from_year`.

           :class:`~spans.types.PeriodRange` has the same interface but is
           period aware. This means it is possible to get things like next week
           or month.

        .. versionchanged:: 0.4.0
           Added the period parameter.
        """

        if period is None or period == "day":
            return cls(date, date, upper_inc=True)
        elif period == "week":
            start = date - timedelta(date.weekday())
            return cls(start, start + timedelta(7))
        elif period == "american_week":
            start = date - timedelta((date.weekday() + 1) % 7)
            return cls(start, start + timedelta(7))
        elif period == "month":
            start = date.replace(day=1)
            return cls(start, (start + timedelta(31)).replace(day=1))
        elif period == "quarter":
            start = date.replace(month=(date.month - 1) // 3 * 3 + 1, day=1)
            return cls(start, (start + timedelta(93)).replace(day=1))
        elif period == "year":
            start = date.replace(month=1, day=1)
            return cls(start, (start + timedelta(366)).replace(day=1))
        else:
            raise ValueError("Unexpected period, got {!r}".format(period))
Create a day long daterange from for the given date.

            >>> daterange.from_date(date(2000, 1, 1))
            daterange([datetime.date(2000, 1, 1),datetime.date(2000, 1, 2)))

        :param date: A date to convert.
        :param period: The period to normalize date to. A period may be one of:
                       ``day`` (default), ``week``, ``american_week``,
                       ``month``, ``quarter`` or ``year``.
        :return: A new range that contains the given date.


        .. seealso::

           There are convenience methods for most period types:
           :meth:`~spans.types.daterange.from_week`,
           :meth:`~spans.types.daterange.from_month`,
           :meth:`~spans.types.daterange.from_quarter` and
           :meth:`~spans.types.daterange.from_year`.

           :class:`~spans.types.PeriodRange` has the same interface but is
           period aware. This means it is possible to get things like next week
           or month.

        .. versionchanged:: 0.4.0
           Added the period parameter.