def has_attribute(obj, key):
    """
    Check if a python object contains a given attributed or if a dict contains a key,
    via a common API
    :param obj: python object or dict that will be queried
    :param key: an attribute name or a key that will be looked
    :return: A boolean that describes if the attribute or key has been found
    """
    if type(obj) is dict:
        return key in obj
    else:
        return hasattr(obj, key)
