def parse_int_header(dictionary, key):
    """Defensively parse an int header"""
    val = dictionary.get(key)
    if val is None or not isinstance(val, str):
        return None
    if not val.isdigit():
        return None
    return int(val)
