<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tz_to_utc(dt, tz, ignoretz=True):
 """Converts a datetime object from the specified timezone to a UTC datetime. :param tz: the timezone the datetime is currently in. tz can be passed as a string or as a timezone object. (i.e. 'US/Central' or pytz.timezone('US/Central'), etc) :param ignoretz: will ignore the timezone portion of the datetime object and tzinfo will be None. :return: the datetime object by in UTC time. Examples: 2011-11-25 15:00:00 2011-11-25 15:00:00 2011-11-25 15:00:00+00:00 """

    if isinstance(tz, string_types):
        tz = pytz.timezone(tz)

    dt = tz.localize(dt)
    dt = datetime.astimezone(dt, pytz.timezone('UTC'))

    if ignoretz:
        return dt.replace(tzinfo=None)
    return dt