def _get_or_set_default_time(d, key, default):
    """
    Dictionary helper. If the key is not in the d dictionary or the value is set to -1 it will set the key to default
     and return default otherwise returns the value from d.
    :param d: dictionary
    :param key: key we are interested in
    :param default: the default value in case the key is not in d or value -1
    :return: value
    """
    if key in d and d[key] != -1:
        return d[key]
    d[key] = default
    return default