def key2int(key, dic):
    """ Gets integer entry from dict and returns None if the key does not exist or if there is a ValueError. """
    value=None
    if key in dic.keys():
        try:
            value=int(dic[key])
        except ValueError:
            value=None
    return value