import re


def parse_time(argument):
    """Turn human-inputted time into seconds"""
    time_ = re.match(r"(\d*)([smhdwMy])", argument)
    times = {
        "s": 1,
        "m": 60,
        "h": 60**2,
        "d": 60**2 * 24,
        "w": 60**2 * 24 * 7,
        "M": 60**2 * 24 * 30,
        "y": 60**2 * 24 * 365
    }
    if time_ is None:
        raise Exception
    return int(time_.group(1)) * times[time_.group(2)]