def parse_locktime(s):
    s = re.sub('[ ,:\\-]+', '-', s)
    for fmt1 in ['%Y-%m-%dT', '%Y-%m-%d', '%b-%d-%Y', '%b-%d-%y', '%B-%d-%Y', '%B-%d-%y']:
        for fmt2 in ['T%H-%M-%S', 'T%H-%M', '-%H-%M-%S', '-%H-%M', '']:
            fmt = (fmt1 + fmt2)
            try:
                when = datetime.datetime.strptime(s, fmt)
                if (when < EARLIEST_DATE):
                    raise ValueError(('invalid date: must be after %s' % EARLIEST_DATE))
                return calendar.timegm(when.timetuple())
            except ValueError:
                pass
    return int(s)
def parse_locktime(s):
    s = re.sub('[ ,:\\-]+', '-', s)
    for fmt1 in ['%Y-%m-%dT', '%Y-%m-%d', '%b-%d-%Y', '%b-%d-%y', '%B-%d-%Y', '%B-%d-%y']:
        for fmt2 in ['T%H-%M-%S', 'T%H-%M', '-%H-%M-%S', '-%H-%M', ]:
            fmt = (fmt1 + fmt2)
            try:
                when = datetime.datetime.strptime(s, fmt)
                if (when < EARLIEST_DATE):
                    raise ValueError(('invalid date: must be after %s' % EARLIEST_DATE))
                return calendar.timegm(when.timetuple())
            except ValueError:
                pass
    return int(s)