Day index of year from 1 to 365 or 366

def day_of_year(dt):
        # type: (int) -> int
        """Day index of year from 1 to 365 or 366"""
        sec = time.mktime(dt.timetuple())
        t = time.localtime(sec)
        return t.tm_yday