@staticmethod
def parse8601(timestamp=None):
    if (timestamp is None):
        return timestamp
    yyyy = '([0-9]{4})-?'
    mm = '([0-9]{2})-?'
    dd = '([0-9]{2})(?:T|[\\s])?'
    h = '([0-9]{2}):?'
    m = '([0-9]{2}):?'
    s = '([0-9]{2})'
    ms = '(\\.[0-9]{1,3})?'
    tz = '(?:(\\+|\\-)([0-9]{2})\\:?([0-9]{2})|Z)?'
    regex = (((((((('' + yyyy) + mm) + dd) + h) + m) + s) + ms) + tz)
    try:
        match = re.search(regex, timestamp, re.IGNORECASE)
        if (match is None):
            return None
        (yyyy, mm, dd, h, m, s, ms, sign, hours, minutes) = match.groups()
        ms = (ms or '.000')
        msint = int(ms[1:])
        sign = (sign or '')
        sign = int((sign + '1'))
        hours = (int((hours or 0)) * sign)
        minutes = (int((minutes or 0)) * sign)
        offset = datetime.timedelta(hours=hours, minutes=minutes)
        string = (((((((yyyy + mm) + dd) + h) + m) + s) + ms) + 'Z')
        dt = datetime.datetime.strptime(string, '%Y%m%d%H%M%S.%fZ')
        dt = (dt + offset)
        return ((calendar.timegm(dt.utctimetuple()) * 1000) + msint)
    except (TypeError, OverflowError, OSError, ValueError):
        return None
@staticmethod
def parse8601(timestamp=None):
    if (timestamp is None):
        return timestamp
    yyyy = '([0-9]{4})-?'
    mm = '([0-9]{2})-?'
    dd = '([0-9]{2})(?:T|[\\s])?'
    h = '([0-9]{2}):?'
    m = '([0-9]{2}):?'
    s = '([0-9]{2})'
    ms = '(\\.[0-9]{1,3})?'
    tz = '(?:(\\+|\\-)([0-9]{2})\\:?([0-9]{2})|Z)?'
    regex = (((((((( + yyyy) + mm) + dd) + h) + m) + s) + ms) + tz)
    try:
        match = re.search(regex, timestamp, re.IGNORECASE)
        if (match is None):
            return None
        (yyyy, mm, dd, h, m, s, ms, sign, hours, minutes) = match.groups()
        ms = (ms or '.000')
        msint = int(ms[1:])
        sign = (sign or )
        sign = int((sign + '1'))
        hours = (int((hours or 0)) * sign)
        minutes = (int((minutes or 0)) * sign)
        offset = datetime.timedelta(hours=hours, minutes=minutes)
        string = (((((((yyyy + mm) + dd) + h) + m) + s) + ms) + 'Z')
        dt = datetime.datetime.strptime(string, '%Y%m%d%H%M%S.%fZ')
        dt = (dt + offset)
        return ((calendar.timegm(dt.utctimetuple()) * 1000) + msint)
    except (TypeError, OverflowError, OSError, ValueError):
        return None