def value_to_int(attrib, key):
    """ Massage runs in an inning to 0 if an empty string,
    or key not found. Otherwise return the value """
    val = attrib.get(key, 0)
    if isinstance(val, str):
        if val.isspace() or val == '':
            return 0
    return val
Massage runs in an inning to 0 if an empty string,
    or key not found. Otherwise return the value