def replace(self, year=None, month=None, day=None, hour=None,
                minute=None, second=None, microsecond=None, tzinfo=None):
        """
        Return a :py:class:`khayyam.JalaliDatetime` instance with the same attributes, except for those attributes
        given new values by whichever keyword arguments are specified. Note that tzinfo=None can be specified to create
        a naive datetime from an aware datetime with no conversion of date and time data, without adjusting the date
        the and time based tzinfo.

        :param year: int
        :param month: int
        :param day: int
        :param hour: int
        :param minute: int
        :param second: int
        :param microsecond: int
        :param tzinfo: :py:class:`datetime.tzinfo`
        :rtype: :py:class:`khayyam.JalaliDatetime`
        """
        year, month, day = self._validate(
            year if year else self.year,
            month if month else self.month,
            day if day else self.day
        )

        result = JalaliDatetime(
            year,
            month,
            day,
            self.hour if hour is None else hour,
            self.minute if minute is None else minute,
            self.second if second is None else second,
            self.microsecond if microsecond is None else microsecond,
            tzinfo if tzinfo != self.tzinfo else self.tzinfo
        )
        return result