def safe_getitem(dct, key, item):
    """Return either dct[key][item],  dct[key].item, or None, whichever
    is appropriate
    """
    if key not in dct:
        return None
    value = dct[key]
    try:
        result = value[item]
    except TypeError:
        if isinstance(item, str):
            result = getattr(value, item, None)
        else:
            result = None
    except (KeyError, IndexError) as ex:
        result = None
    return result
