the following example shows basic prototype of how one would define time zonevariables that must be defined tzoffset timezone offset in hours from utc for exampleus/cst is - hours dstname name of timezone when dst is in effect stdname name of timezone when dst not in effect class somezone(datetime tzinfo)def utcoffset(self,dt)return datetime timedelta(hours=tzoffsetself dst(dtdef dst(self,dt)is_dst(is function you must implement to see whether dst is in effect according to local timezone rules if is_dst(dt)return datetime timedelta(hours= elsereturn datetime timedelta( def tzname(self,dt)if is_dst(dt)return dstname elsereturn stdname number of examples of defining time zones can also be found in the online documentation for datetime date and time parsing common question that arises with date handling is how to parse different kinds of time and date strings into an appropriate datetime object the only parsing function that is really provided by the datetime module is datetime strptime(howeverin order to use thisyou need to specify the precise date format using various combinations of format codes (see time strptime()for exampleto parse the date string ="aug "you would have to use datetime datetime strptime( "% % % "for "fuzzydate parsing that automatically understands number of common date formatsyou must turn to third-party modules go to the python package index (see alsotime ( errno the errno module defines symbolic names for the integer error codes returned by various operating system callsespecially those found in the os and socket modules these codes are typically found in the errno attribute of an oserror or ioerror exception the os strerror(function can be used to translate an error code into string error message the following dictionary can also be used to translate an integer error code into its symbolic namef lib fl ff