def interval_in_sec(val):
    """Translates interval string to seconds int"""
    if val is None:
        return None
    if isinstance(val, int):
        return val
    range_split = val.split()
    if len(range_split) != 2:
        raise ValueError('Interval must be "number date_range_unit", examples: (2 hours, 4 minutes,6 months, 1 day.')
    number = int(range_split[0])
    range_unit = range_split[1].lower()
    if range_unit not in ['minute', 'minutes', 'hour', 'hours', 'day', 'days']:
        raise ValueError('The unit of Interval is invalid. Must be minutes, hours or days')

    multipliers = {
        'minute': 60,
        'hour': 3600,
        'day': 86400,
    }
    for m, m_value in multipliers.items():
        if m in range_unit:
            return number * m_value

    return None