from datetime import datetime


def number_to_datetime(dword_time: int):
    """
    convert 4 byte number to datetime
    :param dword_time: 4 byte number
    :return: datetime object
    """
    base_number = dword_time
    temp1 = ((base_number * 0x88888889) >> 32) & 0xFFFFFFFF
    temp2 = temp1 >> 5
    temp3 = temp2 << 4
    second = base_number - ((temp3 - temp2) * 4)
    base_number = temp2
    temp1 = ((base_number * 0x88888889) >> 32) & 0xFFFFFFFF
    temp2 = temp1 >> 5
    temp3 = temp2 << 4
    minute = base_number - ((temp3 - temp2) * 4)

    base_number = temp2
    temp1 = ((base_number * 0xAAAAAAAB) >> 32) & 0xFFFFFFFF
    temp2 = temp1 >> 4
    temp3 = temp2 * 3
    hour = base_number - (temp3 * 8)

    base_number = temp2
    temp1 = ((base_number * 0x8421085) >> 32) & 0xFFFFFFFF
    temp2 = (((base_number - temp1) >> 1) + temp1) >> 4
    temp3 = temp2 << 5
    day = base_number - (temp3 - temp2) + 1

    base_number = temp1
    temp1 = ((base_number * 0xAAAAAAAB) >> 32) & 0xFFFFFFFF
    temp2 = (temp1 >> 3)
    temp3 = temp2 * 12
    month = (base_number - temp3) + 1
    year = temp2 + 0x7D0
    return datetime(year, month, day, hour, minute, second)