def str2time(s):
    suffixes = (
        ('S', 1), ('M', 60), ('H', 60 * 60), ('D', 60 * 60 * 24),
        ('W', 60 * 60 * 24 * 7), ('Y', 60 * 60 * 24 * 365)
    )
    if isinstance(s, types.StringType):
        s = s.upper().strip()
        for (suff, mult) in suffixes:
            if s.endswith(suff):
                return int(float(s[:-1]) * mult)
        try:
            s = int(s)
        except __HOLE__:
            raise ValueError, "Invalid time interval specifier: " + s
    return s
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/names/dns.py/str2time