A helper to retrieve an integer value from a given dictionary
    containing string values.  If the requested value is not present
    in the dictionary, or if it cannot be converted to an integer, a
    default value will be returned instead.

    :param config: The dictionary containing the desired value.
    :param key: The dictionary key for the desired value.
    :param default: The default value to return, if the key isn't set
                    in the dictionary, or if the value set isn't a
                    legal integer value.

    :returns: The desired integer value.

def get_int(config, key, default):
    """
    A helper to retrieve an integer value from a given dictionary
    containing string values.  If the requested value is not present
    in the dictionary, or if it cannot be converted to an integer, a
    default value will be returned instead.

    :param config: The dictionary containing the desired value.
    :param key: The dictionary key for the desired value.
    :param default: The default value to return, if the key isn't set
                    in the dictionary, or if the value set isn't a
                    legal integer value.

    :returns: The desired integer value.
    """

    try:
        return int(config[key])
    except (KeyError, ValueError):
        return default