def format2sec(value):
    """Convert format [value,unit] in seconds"""
    if value is None:
        return 0
    elif isinstance(value, (int, float)):
        return value
    else:
        i = ['sec', 'min', 'hour', 'day'].index(value[1])
        t = int(value[0]) * [1, 60, 3600, 86400][i]
        return t
