'datetime in UTC -> datetime in local time.'

def fromutc(self, dt):

    if (not isinstance(dt, datetime)):
        raise TypeError('fromutc()    requires    a    datetime    argument')
    if (dt.tzinfo is not self):
        raise ValueError('dt.tzinfo    is    not    self')
    dtoff = dt.utcoffset()
    if (dtoff is None):
        raise ValueError('fromutc()    requires    a    non-None    utcoffset()    result')
    dtdst = dt.dst()
    if (dtdst is None):
        raise ValueError('fromutc()    requires    a    non-None    dst()    result')
    delta = (dtoff - dtdst)
    if delta:
        dt += delta
        dtdst = dt.dst()
        if (dtdst is None):
            raise ValueError('fromutc():    dt.dst    gave    inconsistent    results;    cannot    convert')
    return (dt + dtdst)
