parameters: (self, dt)
return_statement: return self.fromutc(dt)
docstring: Correct the timezone information on the given datetime
  
          If date arithmetic crosses DST boundaries, the tzinfo
          is not magically adjusted. This method normalizes the
          tzinfo to the correct one.
  
          To test, first we need to do some setup
  
          >>> from pytz import timezone
          >>> utc = timezone('UTC')
          >>> eastern = timezone('US/Eastern')
          >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)'
  
          We next create a datetime right on an end-of-DST transition point,
          the instant when the wallclocks are wound back one hour.
  
          >>> utc_dt = datetime(2002, 10, 27, 6, 0, 0, tzinfo=utc)
          >>> loc_dt = utc_dt.astimezone(eastern)
          >>> loc_dt.strftime(fmt)
          '2002-10-27 01:00:00 EST (-0500)'
  
          Now, if we subtract a few minutes from it, note that the timezone
          information has not changed.
  
          >>> before = loc_dt - timedelta(minutes=10)
          >>> before.strftime(fmt)
          '2002-10-27 00:50:00 EST (-0500)'
  
          But we can fix that by calling the normalize method
  
          >>> before = eastern.normalize(before)
          >>> before.strftime(fmt)
          '2002-10-27 01:50:00 EDT (-0400)'
  
          The supported method of converting between timezones is to use
          datetime.astimezone(). Currently, normalize() also works:
  
          >>> th = timezone('Asia/Bangkok')
          >>> am = timezone('Europe/Amsterdam')
          >>> dt = th.localize(datetime(2011, 5, 7, 1, 2, 3))
          >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)'
          >>> am.normalize(dt).strftime(fmt)
          '2011-05-06 20:02:03 CEST (+0200)'
docstring_summary: Correct the timezone information on the given datetime
docstring_tokens: Correct the timezone information on the given datetime
function: def normalize(self, dt):
          '''Correct the timezone information on the given datetime
  
          If date arithmetic crosses DST boundaries, the tzinfo
          is not magically adjusted. This method normalizes the
          tzinfo to the correct one.
  
          To test, first we need to do some setup
  
          >>> from pytz import timezone
          >>> utc = timezone('UTC')
          >>> eastern = timezone('US/Eastern')
          >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)'
  
          We next create a datetime right on an end-of-DST transition point,
          the instant when the wallclocks are wound back one hour.
  
          >>> utc_dt = datetime(2002, 10, 27, 6, 0, 0, tzinfo=utc)
          >>> loc_dt = utc_dt.astimezone(eastern)
          >>> loc_dt.strftime(fmt)
          '2002-10-27 01:00:00 EST (-0500)'
  
          Now, if we subtract a few minutes from it, note that the timezone
          information has not changed.
  
          >>> before = loc_dt - timedelta(minutes=10)
          >>> before.strftime(fmt)
          '2002-10-27 00:50:00 EST (-0500)'
  
          But we can fix that by calling the normalize method
  
          >>> before = eastern.normalize(before)
          >>> before.strftime(fmt)
          '2002-10-27 01:50:00 EDT (-0400)'
  
          The supported method of converting between timezones is to use
          datetime.astimezone(). Currently, normalize() also works:
  
          >>> th = timezone('Asia/Bangkok')
          >>> am = timezone('Europe/Amsterdam')
          >>> dt = th.localize(datetime(2011, 5, 7, 1, 2, 3))
          >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)'
          >>> am.normalize(dt).strftime(fmt)
          '2011-05-06 20:02:03 CEST (+0200)'
          '''
          if dt.tzinfo is None:
              raise ValueError('Naive time - no tzinfo set')
  
          # Convert dt in localtime to UTC
          offset = dt.tzinfo._utcoffset
          dt = dt.replace(tzinfo=None)
          dt = dt - offset
          # convert it back, and return it
          return self.fromutc(dt)
function_tokens: def normalize ( self , dt ) : if dt . tzinfo is None : raise ValueError ( 'Naive time - no tzinfo set' ) # Convert dt in localtime to UTC offset = dt . tzinfo . _utcoffset dt = dt . replace ( tzinfo = None ) dt = dt - offset # convert it back, and return it return self . fromutc ( dt )