def get_int_with_default(val, default):
    """Atempts to comvert input to an int. Returns default if input is None or unable to convert to
    an int.
    """
    if val is None:
        return default
    try:
        return int(val)
    except ValueError:
        pass
    return default