code: def num2date(x, tz=None, naive=True):
      # Same as matplotlib except if tz is None a naive datetime object
      # will be returned.
      """
      *x* is a float value which gives the number of days
      (fraction part represents hours, minutes, seconds) since
      0001-01-01 00:00:00 UTC *plus* *one*.
      The addition of one here is a historical artifact.  Also, note
      that the Gregorian calendar is assumed; this is not universal
      practice.  For details, see the module docstring.
      Return value is a :class:`datetime` instance in timezone *tz* (default to
      rcparams TZ value).
      If *x* is a sequence, a sequence of :class:`datetime` objects will
      be returned.
      """
  
      ix = int(x)
      dt = datetime.datetime.fromordinal(ix)
      remainder = float(x) - ix
      hour, remainder = divmod(HOURS_PER_DAY * remainder, 1)
      minute, remainder = divmod(MINUTES_PER_HOUR * remainder, 1)
      second, remainder = divmod(SECONDS_PER_MINUTE * remainder, 1)
      microsecond = int(MUSECONDS_PER_SECOND * remainder)
      if microsecond < 10:
          microsecond = 0  # compensate for rounding errors
  
      if True and tz is not None:
          dt = datetime.datetime(
              dt.year,
              dt.month,
              dt.day,
              int(hour),
              int(minute),
              int(second),
              microsecond,
              tzinfo=UTC,
          )
          dt = dt.astimezone(tz)
          if naive:
              dt = dt.replace(tzinfo=None)
      else:
          # If not tz has been passed return a non-timezoned dt
          dt = datetime.datetime(
              dt.year,
              dt.month,
              dt.day,
              int(hour),
              int(minute),
              int(second),
              microsecond,
          )
  
      if microsecond > 999990:  # compensate for rounding errors
          dt += datetime.timedelta(microseconds=1e6 - microsecond)
  
      return dt
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import datetime
  import math
  import time
  from .py3 import string_types
label_desc: Use image node_id 3 for calling a global function with example usage: num2date(x, tz, naive) and returns: dt