def utc_to_localtime(
        date_str,
        fmt="%Y-%m-%d %H:%M:%S",
        input_fmt="%Y-%m-%dT%H:%M:%SZ"):
    """
    Convert UTC to localtime

    Reference:
     - (1) http://www.openarchives.org/OAI/openarchivesprotocol.html#Dates
     - (2) http://www.w3.org/TR/NOTE-datetime

    This function works only with dates complying with the
    "Complete date plus hours, minutes and seconds" profile of
    ISO 8601 defined by (2), and linked from (1).

    Eg:    1994-11-05T13:15:30Z
    """
    date_struct = datetime.strptime(date_str, input_fmt)
    date_struct += timedelta(hours=get_dst(date_struct))
    date_struct -= timedelta(seconds=time.timezone)
    return strftime(fmt, date_struct)
Convert UTC to localtime

    Reference:
     - (1) http://www.openarchives.org/OAI/openarchivesprotocol.html#Dates
     - (2) http://www.w3.org/TR/NOTE-datetime

    This function works only with dates complying with the
    "Complete date plus hours, minutes and seconds" profile of
    ISO 8601 defined by (2), and linked from (1).

    Eg:    1994-11-05T13:15:30Z