from dateutil import tz
from datetime import datetime


def utctolocaltime(strtime, localzone='Australia/Melbourne'):
    """ covert input string time to local time
    eg. 
    - utctolocaltime('2021-10-06T17:33:00Z', localzone='Australia/Melbourne')
    - output: 2021-10-07 04:33:00+11:00
    """

    from_zone = tz.gettz('UTC')
    to_zone = tz.gettz(localzone)

    outtime = datetime.strptime(strtime, '%Y-%m-%dT%H:%M:%SZ')
    outtime = outtime.replace(tzinfo=from_zone)
    outtime = outtime.astimezone(to_zone)
    #print(type(outtime))
    #return outtime.strftime("%c")
    return outtime