code: def Localizer(tz):
      import types
  
      def localize(self, dt):
          return dt.replace(tzinfo=self)
  
      if tz is not None and not hasattr(tz, "localize"):
          # patch the tz instance with a bound method
          tz.localize = types.MethodType(localize, tz)
  
      return tz
  
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 2 for calling a global function with example usage: Localizer(tz) and returns: tz, dt