(s, default_tz = None)
return datetime(int(m.group('year')),
                int(m.group('month')),
                int(m.group('day')),
                int(m.group('hour')),
                int(m.group('min')),
                m.group('sec') and int(m.group('sec')) or 0,
                m.group('ss') and int(m.group('ss').ljust(6, '0')) or 0,
                tz)
Parse ISO timestamp to datetime object.
    
    YYYY-MM-DD[ T]HH:MM[:SS[.ss]][-+HH[:MM]]

    Assumes that second fractions are zero-trimmed from the end,
    so '.15' means 150000 microseconds.

    If the timezone offset is not present, use default_tz as tzinfo.
    By default its None, meaning the datetime object will be without tz.

    Only fixed offset timezones are supported.

    >>> str(parse_iso_timestamp('2005-06-01 15:00'))
    '2005-06-01 15:00:00'
    >>> str(parse_iso_timestamp(' 2005-06-01T15:00 +02 '))
    '2005-06-01 15:00:00+02:00'
    >>> str(parse_iso_timestamp('2005-06-01 15:00:33+02:00'))
    '2005-06-01 15:00:33+02:00'
    >>> d = parse_iso_timestamp('2005-06-01 15:00:59.33 +02')
    >>> d.strftime("%z %Z")
    '+0200 +02'
    >>> str(parse_iso_timestamp(str(d)))
    '2005-06-01 15:00:59.330000+02:00'
    >>> parse_iso_timestamp('2005-06-01 15:00-0530').strftime('%Y-%m-%d %H:%M %z %Z')
    '2005-06-01 15:00 -0530 -05:30'
    >>> parse_iso_timestamp('2014-10-27T11:59:13Z').strftime('%Y-%m-%d %H:%M:%S %z %Z')
    '2014-10-27 11:59:13 +0000 +00'
Parse ISO timestamp to datetime object.
    
    YYYY-MM-DD[ T]HH:MM[:SS[.ss]][-+HH[:MM]]
Parse ISO timestamp to datetime object . YYYY - MM - DD [ T ] HH : MM [ : SS [ . ss ]] [ - + HH [ : MM ]]
def parse_iso_timestamp(s, default_tz = None):
    """Parse ISO timestamp to datetime object.
    
    YYYY-MM-DD[ T]HH:MM[:SS[.ss]][-+HH[:MM]]

    Assumes that second fractions are zero-trimmed from the end,
    so '.15' means 150000 microseconds.

    If the timezone offset is not present, use default_tz as tzinfo.
    By default its None, meaning the datetime object will be without tz.

    Only fixed offset timezones are supported.

    >>> str(parse_iso_timestamp('2005-06-01 15:00'))
    '2005-06-01 15:00:00'
    >>> str(parse_iso_timestamp(' 2005-06-01T15:00 +02 '))
    '2005-06-01 15:00:00+02:00'
    >>> str(parse_iso_timestamp('2005-06-01 15:00:33+02:00'))
    '2005-06-01 15:00:33+02:00'
    >>> d = parse_iso_timestamp('2005-06-01 15:00:59.33 +02')
    >>> d.strftime("%z %Z")
    '+0200 +02'
    >>> str(parse_iso_timestamp(str(d)))
    '2005-06-01 15:00:59.330000+02:00'
    >>> parse_iso_timestamp('2005-06-01 15:00-0530').strftime('%Y-%m-%d %H:%M %z %Z')
    '2005-06-01 15:00 -0530 -05:30'
    >>> parse_iso_timestamp('2014-10-27T11:59:13Z').strftime('%Y-%m-%d %H:%M:%S %z %Z')
    '2014-10-27 11:59:13 +0000 +00'
    """

    global _iso_rc
    if _iso_rc is None:
        _iso_rc = re.compile(_iso_regex, re.X)

    m = _iso_rc.match(s)
    if not m:
        raise ValueError('Date not in ISO format: %s' % repr(s))

    tz = default_tz
    if m.group('tzsign'):
        tzofs = int(m.group('tzhr')) * 60
        if m.group('tzmin'):
            tzofs += int(m.group('tzmin'))
        if m.group('tzsign') == '-':
            tzofs = -tzofs
        tz = FixedOffsetTimezone(tzofs)
    elif m.group('tzname'):
        tz = UTC

    return datetime(int(m.group('year')),
                int(m.group('month')),
                int(m.group('day')),
                int(m.group('hour')),
                int(m.group('min')),
                m.group('sec') and int(m.group('sec')) or 0,
                m.group('ss') and int(m.group('ss').ljust(6, '0')) or 0,
                tz)
def parse_iso_timestamp ( s , default_tz = None ) : global _iso_rc if _iso_rc is None : _iso_rc = re . compile ( _iso_regex , re . X ) m = _iso_rc . match ( s ) if not m : raise ValueError ( 'Date not in ISO format: %s' % repr ( s ) ) tz = default_tz if m . group ( 'tzsign' ) : tzofs = int ( m . group ( 'tzhr' ) ) * 60 if m . group ( 'tzmin' ) : tzofs += int ( m . group ( 'tzmin' ) ) if m . group ( 'tzsign' ) == '-' : tzofs = - tzofs tz = FixedOffsetTimezone ( tzofs ) elif m . group ( 'tzname' ) : tz = UTC return datetime ( int ( m . group ( 'year' ) ) , int ( m . group ( 'month' ) ) , int ( m . group ( 'day' ) ) , int ( m . group ( 'hour' ) ) , int ( m . group ( 'min' ) ) , m . group ( 'sec' ) and int ( m . group ( 'sec' ) ) or 0 , m . group ( 'ss' ) and int ( m . group ( 'ss' ) . ljust ( 6 , '0' ) ) or 0 , tz )