def fromtimestamp(cls, timestamp, tz=None):
        """
        Creates a new :py:class:`khayyam.JalaliDatetime` instance from the given posix timestamp.

        If optional argument tz is :py:obj:`None` or not specified, the timestamp is converted to
        the platform's local date and time, and the returned datetime object is naive.

        Else tz must be an instance of a class :py:class:`datetime.tzinfo` subclass,
        and the timestamp is converted to tz's time zone. In this case the result is
        equivalent to `tz.fromutc(JalaliDatetime.utcfromtimestamp(timestamp).replace(tzinfo=tz))`.

        This method may raise `ValueError`, if the timestamp is out of the range of values
        supported by the platform C localtime() or gmtime() functions.
        It's common for this to be restricted to years in 1970 through 2038.

        Note that on non-POSIX systems that include leap seconds in their
        notion of a timestamp, leap seconds are ignored by fromtimestamp(), and then
        it's possible to have two timestamps differing by a second that yield
        identical datetime objects. See also :py:class:`khayyam.JalaliDatetime.utcfromtimestamp`.

        .. testsetup:: api-datetime-fromtimestamp

            import khayyam
            from khayyam import JalaliDatetime

        .. doctest:: api-datetime-fromtimestamp

            >>> JalaliDatetime.fromtimestamp(1313132131.21232)
            khayyam.JalaliDatetime(1390, 5, 21, 11, 25, 31, 212320, Jomeh)

        :param timestamp: float the posix timestamp, i.e 1014324234.23423423.
        :param tz: :py:class:`datetime.tzinfo` The optional timezone to get local date & time from the given timestamp.
        :return: The local date and time corresponding to the POSIX timestamp, such as is returned by :py:func:`time.time()`.
        :rtype: :py:class:`khayyam.JalaliDatetime`
        """
        return cls(datetime.fromtimestamp(timestamp, tz=tz))