def timespec(value):
    """Parse the 'timespec' option:

    >>> timespec(1)
    1
    >>> timespec('5m')
    300
    >>> timespec('1h')
    3600
    """
    try:
        return int(value)
    except ValueError:
        multiply = {'s': 1, 'm': 60, 'h': 3600}
        suffix = value[-1]
        msg = 'invalid timespec value {} - hint: 60, 60s, 1m, 1h'
        if suffix in multiply:
            try:
                v = int(value[:-1])
                return v * multiply[suffix]
            except ValueError:
                ValueError(msg.format(value))
        else:
            raise ValueError(msg.format(value))
