def get_dict_value(key, data):
    """Return data[key] with improved KeyError."""
    try:
        return data[key]
    except (KeyError, TypeError):
        raise KeyError("No key [%s] in [%s]" % (key, data))