What about this? I presume it can be counted on to handle dates before 1970 and after 2038.
target_datetime_ms = 200000 # or whatever
base_datetime = datetime.datetime(1970, 1, 1)
delta = datetime.timedelta(0, 0, 0, target_datetime_ms)
target_datetime = base_datetime + delta
as mentioned in the Python standard lib:
fromtimestamp() 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.
Very obviously, this can be done in one line:
target_dt = datetime(1970, 1, 1) + timedelta(milliseconds=target_dt_ms)