def return_item(item, key, silently=False):
    """Depending of the type of item, return the value corresponding to `key`
    or the attribute `key` of the object item.

    Args:
        item (dict or object): Python object to explore
        key (str): key to search in the object
        silently (bool, optional): whether or not the function should
            raises an error if key is not found. Default to False
    Returns:
        object:
    """
    if isinstance(item, dict):
        return item.get(key, None) if silently else item[key]
    return getattr(item, key, None) if silently else getattr(item, key)